I'm using the pgdumplib lib. Unfortunately there is an error, when I'm trying to open the file. The file is in the same folder as the python script. I'm using Python 3.7
Code:
import pgdumplib
dump = pgdumplib.load('test.dump')
print('Database: {}'.format(dump.toc.dbname))
print('Archive Timestamp: {}'.format(dump.toc.timestamp))
print('Server Version: {}'.format(dump.toc.server_version))
print('Dump Version: {}'.format(dump.toc.dump_version))
for line in dump.table_data('public', 'pgbench_accounts'):
print(line)
Error:
Traceback (most recent call last):
File "C:/Users/user/data/test.py", line 3, in <module>
dump = pgdumplib.load('test.dump')
File "C:\Users\user\venv\data\lib\site-packages\pgdumplib\__init__.py", line 24, in load
return dump.Dump(converter=converter).load(filepath)
File "C:\Users\user\venv\data\lib\site-packages\pgdumplib\dump.py", line 228, in load
raise ValueError('Path {!r} does not exist'.format(path))
ValueError: Path 'test.dump' does not exist
If you are running your code from C:/Users/user/700Joach/project/ and you have the following line in your script:
dump = pgdumplib.load('test.dump')
Then, python would look for the following path to open test.dump:
C:/Users/user/700Joach/project/test.dump
Namely, this part: load('test.dump') internally is forging a relative path to test.dump.
You can do several things to resolve the issue. Either move test.dump to the directory from which you are executing your code. Or, provide an absolute path to your test.dump as follows:
dump = pgdumplib.load('C:/Users/user/700Joach/project/test.dump')
I'm trying to use Ezsheets through IDLE and I managed to set it up ok, but when I go to open a Google sheet I keep having this error come up. Have I put the file in the wrong place? I tried re-downloading the credential-sheets.json to no avail.
>>> import ezsheets
>>> ss = ezsheets.Spreadsheet('1yX5ysHDlc086WnjNWX_4RVAYKqefW9YrBTVWzGIQS2Q')
Traceback (most recent call last):
File "<pyshell#5>", line 1, in <module>
ss = ezsheets.Spreadsheet('1yX5ysHDlc086WnjNWX_4RVAYKqefW9YrBTVWzGIQS2Q')
File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\ezsheets\__init__.py", line 183, in __init__
init() # Initialize this module if not done so already.
File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\ezsheets\__init__.py", line 1669, in init
raise EZSheetsException(
ezsheets.EZSheetsException: Can't find credentials file at C:\Users\User\AppData\Local\Programs\Python\Python39-32\credentials-sheets.json. You can download this file from https://developers.google.com/sheets/api/quickstart/python and clicking "Enable the Google Sheets API". Rename the downloaded file to credentials-sheets.json.
I am a complete novice at Python and I wish to run a script someone has made up to check against a critical windows vulnerability. I downloaded python and I thought I had downloaded all the modules and everything needed to run this script, but I keep getting an error: Please see below
C:\Users\bhanney\AppData\Local\Programs\Python\Python38-32\Lib\site-packages>zerologon.py Dc_Name IP_address ( I put this here but I edited it for confidentiality)
Traceback (most recent call last):
File "C:\Users\bhanney\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\zerologon.py", line 3, in <module>
from impacket.dcerpc.v5 import nrpc, epm
File "C:\Users\bhanney\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\impacket\dcerpc\v5\nrpc.py", line 30, in <module>
from impacket.dcerpc.v5.samr import OLD_LARGE_INTEGER
File "C:\Users\bhanney\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\impacket\dcerpc\v5\samr.py", line 29, in <module>
from impacket.dcerpc.v5.rpcrt import DCERPCException
File "C:\Users\bhanney\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\impacket\dcerpc\v5\rpcrt.py", line 24, in <module>
from Cryptodome.Cipher import ARC4
File "C:\Users\bhanney\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\Cryptodome\Cipher\__init__.py", line 27, in <module>
from Cryptodome.Cipher._mode_ecb import _create_ecb_cipher
File "C:\Users\bhanney\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\Cryptodome\Cipher\_mode_ecb.py", line 35, in <module>
raw_ecb_lib = load_pycryptodome_raw_lib("Cryptodome.Cipher._raw_ecb", """
File "C:\Users\bhanney\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\Cryptodome\Util\_raw_api.py", line 308, in load_pycryptodome_raw_lib
raise OSError("Cannot load native module '%s': %s" % (name, ", ".join(attempts)))
OSError: Cannot load native module 'Cryptodome.Cipher._raw_ecb': Trying '_raw_ecb.cp38-win_amd64.pyd': cannot load library 'C:\Users\bhanney\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\Cryptodome\Util\..\Cipher\_raw_ecb.cp38-win_amd64.pyd': error 0x7e. Additionally, ctypes.util.find_library() did not manage to locate a library called 'C:\\Users\\bhanney\\AppData\\Local\\Programs\\Python\\Python38-32\\Lib\\site-packages\\Cryptodome\\Util\\..\\Cipher\\_raw_ecb.cp38-win_amd64.pyd', Trying '_raw_ecb.pyd': cannot load library 'C:\Users\bhanney\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\Cryptodome\Util\..\Cipher\_raw_ecb.pyd': error 0x7e. Additionally, ctypes.util.find_library() did not manage to locate a library called 'C:\\Users\\bhanney\\AppData\\Local\\Programs\\Python\\Python38-32\\Lib\\site-packages\\Cryptodome\\Util\\..\\Cipher\\_raw_ecb.pyd'
Here is a link to the github script: https://github.com/SecuraBV/CVE-2020-1472 , let me know if anyone can assist because I have no clue what I'm doing wrong
Since you said you're a novice at Python, I'll try to help you.. but you should definetely take a look at the links provided in the first comment.
So, after the formalities, let's read your error message together..
C:\Users\bhanney\AppData\Local\Programs\Python\Python38-32\Lib\site-packages>zerologon.py Dc_Name IP_address
the error was caused by this command: zerologon.py Dc_Name IP_address
Traceback (most recent call last):
traceback will show the error at the top and their dependencies...
File "C:\Users\bhanney\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\zerologon.py", line 3, in <module>
from impacket.dcerpc.v5 import nrpc, epm
the first line is located in your script, the zerologon.py, at line 3, where you try to run the following command: from impacket.dcerpc.v5 import nrpc, epm
File "C:\Users\bhanney\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\impacket\dcerpc\v5\nrpc.py", line 30, in <module>
from impacket.dcerpc.v5.samr import OLD_LARGE_INTEGER
File "C:\Users\bhanney\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\impacket\dcerpc\v5\samr.py", line 29, in <module>
from impacket.dcerpc.v5.rpcrt import DCERPCException
File "C:\Users\bhanney\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\impacket\dcerpc\v5\rpcrt.py", line 24, in <module>
from Cryptodome.Cipher import ARC4
File "C:\Users\bhanney\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\Cryptodome\Cipher\__init__.py", line 27, in <module>
from Cryptodome.Cipher._mode_ecb import _create_ecb_cipher
File "C:\Users\bhanney\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\Cryptodome\Cipher\_mode_ecb.py", line 35, in <module>
raw_ecb_lib = load_pycryptodome_raw_lib("Cryptodome.Cipher._raw_ecb", "")
File "C:\Users\bhanney\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\Cryptodome\Util\_raw_api.py", line 308, in load_pycryptodome_raw_lib
raise OSError("Cannot load native module '%s': %s" % (name, ", ".join(attempts)))
and here, in the last "File Error Message", we can see the root of your problem: the file \Python\Python38-32\Lib\site-packages\Cryptodome\Util\_raw_api.py, in line 308, tried to run the command: load_pycryptodome_raw_lib, but it generated an OSError...
OSError: Cannot load native module 'Cryptodome.Cipher._raw_ecb':
here we can see the OSError message: Cannot load native module 'Cryptodome.Cipher._raw_ecb', and the following part shows us the unsuccessful alternative attempts..
Trying '_raw_ecb.cp38-win_amd64.pyd':
cannot load library 'C:\Users\bhanney\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\Cryptodome\Util\..\Cipher\_raw_ecb.cp38-win_amd64.pyd': error 0x7e.
Additionally, ctypes.util.find_library() did not manage to locate a library called 'C:\\Users\\bhanney\\AppData\\Local\\Programs\\Python\\Python38-32\\Lib\\site-packages\\Cryptodome\\Util\\..\\Cipher\\_raw_ecb.cp38-win_amd64.pyd',
Trying '_raw_ecb.pyd': cannot load library 'C:\Users\bhanney\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\Cryptodome\Util\..\Cipher\_raw_ecb.pyd': error 0x7e.
Additionally, ctypes.util.find_library() did not manage to locate a library called 'C:\\Users\\bhanney\\AppData\\Local\\Programs\\Python\\Python38-32\\Lib\\site-packages\\Cryptodome\\Util\\..\\Cipher\\_raw_ecb.pyd'
Ok, so after executing this reading and understanding routine, we can try to find a solution to your problem, by looking at:
Cryptodome Docs
Cryptodome Github Issues
After doing this, you can even specify your search using the raw_ecb text, for example... which leads us to this page, that may be very useful for you:
ISSUES filtered by "_raw_ecb.pyd"
Or this one:
Error loading native modules #185
In this issue, the OP said the following:
"I solved it by installing the VC++ 2008 Redistributable as I could see
in dependencywalker that MSVCR90 was not found"
I know this doesn't clearly answer your question, but it may help you understand how you can fix your code in a more general way..
I have installed openfire server on my fedora 20 machine, and i am trying to connect and insert a new user with following..
from openfire import UserService
api = UserService("192.xxx.x.xxx:9090/", "SecretKey")
i am getting the following error
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/site-packages/python_openfire-0.2.3_beta-py2.7.egg/openfire/user_service.py", line 60, in add_user
'groups': groups_str,
File "/usr/lib/python2.7/site-packages/python_openfire-0.2.3_beta-py2.7.egg/openfire/base.py", line 34, in _submit_request
raise HTTPException(e.reason)
openfire.exception.HTTPException: unknown url type: 192.xxx.x.xxx
i have taken reference from this url:
https://github.com/plazix/python-openfire/blob/master/docs/user_service.md
any help would be appreciated!
Try prepending your URL with the protocol. Eg. HTTP:
api = UserService("http://192.xxx.x.xxx:9090/", "SecretKey")
Obviously, you also need to use a valid IP address or host name instead of "192.xxx.x.xxx".
I try to create a configuration file, where I can store constants.
Whenever I try with ConfigParser, I get an error
Traceback (most recent call last):
File "/home/baun/google_appengine/google/appengine/ext/webapp /__init__.py", line 511, in __call__
handler.get(*groups)
File "/home/baun/workspace/octopuscloud/s3/S3.py", line 138, in get
test = parser.get('bucket', 'bucketname')
File "/usr/lib/python2.5/ConfigParser.py", line 511, in get
raise NoSectionError(section)
NoSectionError: No section: 'bucket'
simple.cfg:
[bucket]
bucketname: 'octopus_storage'
s3.py:
...
from ConfigParser import SafeConfigParser
parser = SafeConfigParser()
parser.read('simple.cfg')
...
# Get values from the config file
test = parser.get('bucket', 'bucketname')
...
How can I fix this?
===============================
The problem is fixed. The code was correct, but simple.cfg was in the wrong directory.
[bucket]
bucketname= octopus_storage