ModuleNotFoundError: No module named 'Users.[USERNAME].[PATH]' on Brownie run command - modulenotfounderror

After I've created a new project with brownie init I compiled a contract and try to run script for deployment with brownie run scripts/deploy.py.
But I've got;
ModuleNotFoundError: No module named 'Users.[USERNAME].[PATH]'
Brownie v1.16.4 - Python development framework for Ethereum
BrownieSimpleStorageProject is the active project.
Launching 'ganache-cli.cmd --port 8545 --gasLimit 12000000 --accounts 10 --hardfork istanbul --mnemonic brownie'...
File "C:\Program, line line, in in
return_value, frame = run(
File "C:\Program, line line, in in
module = _import_from_path(script)
File "C:\Program, line line, in in
_import_cache[import_str] = importlib.import_module(import_str)
File "C:\Program, line line, in in
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
ModuleNotFoundError: No module named 'Users.[userName].Documents.Git.solidity-web3'
Terminating local RPC client...
*P.S. After I moved the project folder outside the 'Users.[USERNAME].[PATH]' directory to 'C:' it worked.

I just had the same issue, brownie doesn't like to have a "." in the path of the file. I assume your folder name includes one. So the only option is to rename it.

Related

Windows fatal exception: access violation \ Process finished with exit code -1073741819 (0xC0000005)

I am trying to debug a Python program named 'RTSPbrute' using faulthandler and PyCharm.
https://gitlab.com/woolf/RTSPbrute/
I receive the error message...
Windows fatal exception: access violation
...using the command prompt, and...
Process finished with exit code -1073741819 (0xC0000005)
...from PyCharm.
I already have logged the Queue from different code locations, where the error is apparently.
Logged the threads...almost everything that is printable.
Debugging step by step for days using Pycharm. Unfortunately I can't find the bug(s).
Strangely enough, the error message keeps appearing at different times, even though i use the same input. Which makes me think the error is Windows or Python related as i often read.
there is a lot of information about the exit code -1073741819 (0xC0000005), but i have not found a working one.
Does anyone know a solution, missing package, maybe better debugging techniques?
The faulthandler output.
Thread 0x00002274 (most recent call first):
File "C:\Users\Update\AppData\Roaming\Python\Python310\site-packages\colorama\win32.py", line 105 in GetConsoleScreenBufferInfo
File "C:\Users\Update\AppData\Roaming\Python\Python310\site-packages\colorama\winterm.py", line 150 in erase_line
File "C:\Users\Update\AppData\Roaming\Python\Python310\site-packages\colorama\ansitowin32.py", line 235 in call_win32
File "C:\Users\Update\AppData\Roaming\Python\Python310\site-packages\colorama\ansitowin32.py", line 202 in convert_ansi
File "C:\Users\Update\AppData\Roaming\Python\Python310\site-packages\colorama\ansitowin32.py", line 188 in write_and_convert
File "C:\Users\Update\AppData\Roaming\Python\Python310\site-packages\colorama\ansitowin32.py", line 162 in write
File "C:\Users\Update\AppData\Roaming\Python\Python310\site-packages\colorama\ansitowin32.py", line 41 in write
File "C:\Users\Update\AppData\Roaming\Python\Python310\site-packages\rich\console.py", line 1932 in _check_buffer
File "C:\Users\Update\AppData\Roaming\Python\Python310\site-packages\rich\console.py", line 800 in _exit_buffer
File "C:\Users\Update\AppData\Roaming\Python\Python310\site-packages\rich\console.py", line 842 in __exit__
File "C:\Users\Update\AppData\Roaming\Python\Python310\site-packages\rich\live.py", line 231 in refresh
File "C:\Users\Update\AppData\Roaming\Python\Python310\site-packages\rich\live.py", line 32 in run
File "C:\Program Files\Python310\lib\threading.py", line 1009 in _bootstrap_inner
File "C:\Program Files\Python310\lib\threading.py", line 966 in _bootstrap
Thread 0x0000240c (most recent call first):
File "C:\Program Files\Python310\lib\threading.py", line 320 in wait
File "C:\Program Files\Python310\lib\queue.py", line 171 in get
File "C:\Users\Update\AppData\Roaming\Python\Python310\site-packages\rtspbrute\modules\worker.py", line 50 in screenshot_targets
File "C:\Program Files\Python310\lib\threading.py", line 946 in run
File "C:\Program Files\Python310\lib\threading.py", line 1009 in _bootstrap_inner
File "C:\Program Files\Python310\lib\threading.py", line 966 in _bootstrap
Thread 0x000025e4 (most recent call first):
File "C:\Users\Update\AppData\Roaming\Python\Python310\site-packages\rtspbrute\modules\attack.py", line 137 in get_screenshot
File "C:\Users\Update\AppData\Roaming\Python\Python310\site-packages\rtspbrute\modules\attack.py", line 186 in get_screenshot
File "C:\Users\Update\AppData\Roaming\Python\Python310\site-packages\rtspbrute\modules\worker.py", line 54 in screenshot_targets
File "C:\Program Files\Python310\lib\threading.py", line 946 in run
File "C:\Program Files\Python310\lib\threading.py", line 1009 in _bootstrap_inner
File "C:\Program Files\Python310\lib\threading.py", line 966 in _bootstrap
Thread 0x0000395c (most recent call first):
File "C:\Program Files\Python310\lib\threading.py", line 320 in wait
File "C:\Program Files\Python310\lib\queue.py", line 171 in get
File "C:\Users\Update\AppData\Roaming\Python\Python310\site-packages\rtspbrute\modules\worker.py", line 50 in screenshot_targets
File "C:\Program Files\Python310\lib\threading.py", line 946 in run
File "C:\Program Files\Python310\lib\threading.py", line 1009 in _bootstrap_inner
File "C:\Program Files\Python310\lib\threading.py", line 966 in _bootstrap
...
Python 3.10.1 (tags/v3.10.1:2cd268a, Dec 6 2021, 19:10:37) [MSC v.1929 64 bit (AMD64)] on win32

python script in cron not reading a CSV unless it creates the CSV itself

I have the following script. It works when I run it in command line, and it works when I run it in cron.
The variable 'apath' is the absolute path of the file.
cat=['a','a','a','a','a','b','b','b','b','b']
val=[1,2,3,4,5,6,7,8,9,10]
columns=['cat','val']
data=[cat,val]
dict={key:value for key,value in zip(columns,data)}
statedata_raw=pd.DataFrame(data=dict)
statedata_raw.to_csv(apath+'state_data.csv',index=False)
statedata_raw2=pd.read_csv(apath+'state_data.csv')
statedata_raw2.to_csv(apath+'state_data2.csv',index=False)
But when I try to run the first part manually, creating the first csv, and then run the second part through cron, the second read_csv statement fails. I checked the permissions on the state_data.csv file and they are fine. It's set to -rwxr-xr-x
To be specific: I first run this script manually through command line. It executes and creates state_data.csv. Then I check the permissions of state_csv, and they are -rwxr-xr-x
cat=['a','a','a','a','a','b','b','b','b','b']
val=[1,2,3,4,5,6,7,8,9,10]
columns=['cat','val']
data=[cat,val]
dict={key:value for key,value in zip(columns,data)}
statedata_raw=pd.DataFrame(data=dict)
statedata_raw.to_csv(apath+'state_data.csv',index=False)
and then this script via cron, which fails, and gives the error message below
statedata_raw2=pd.read_csv(apath+'state_data.csv')
statedata_raw2.to_csv(apath+'state_data2.csv',index=False)
This is the error that I get from the system
Traceback (most recent call last):
File "/users/michaelmader/wdtest.py", line 39, in <module>
statedata_raw2=pd.read_csv(apath+'state_data.csv')
File "/opt/miniconda3/lib/python3.7/site-packages/pandas/io/parsers.py", line 676, in parser_f
return _read(filepath_or_buffer, kwds)
File "/opt/miniconda3/lib/python3.7/site-packages/pandas/io/parsers.py", line 448, in _read
parser = TextFileReader(fp_or_buf, **kwds)
File "/opt/miniconda3/lib/python3.7/site-packages/pandas/io/parsers.py", line 880, in __init__
self._make_engine(self.engine)
File "/opt/miniconda3/lib/python3.7/site-packages/pandas/io/parsers.py", line 1114, in _make_engine
self._engine = CParserWrapper(self.f, **self.options)
File "/opt/miniconda3/lib/python3.7/site-packages/pandas/io/parsers.py", line 1891, in __init__
self._reader = parsers.TextReader(src, **kwds)
File "pandas/_libs/parsers.pyx", line 374, in pandas._libs.parsers.TextReader.__cinit__
File "pandas/_libs/parsers.pyx", line 678, in pandas._libs.parsers.TextReader._setup_parser_source
OSError: Initializing from file failed
To summarize
Run complete script through Terminal: state_data2.csv is created: pass
Run complete script through cron: state_data2.csv is created: pass
Run first part through Terminal, second part through cron: fail
I am on MacOS and I already gave crontab full disk access in system preferences.
I figured out the problem. The issue was the permissions that were granted to cron in MacOS. I thought I had solved it by giving \usr\bin\crontab full disk access, but I actually needed to give full disk access to usr\sbin\cron
The steps for doing this can be found here: https://blog.bejarano.io/fixing-cron-jobs-in-mojave/.
Once I made that change everything worked fine.

Indexing audio to get timestamps for each word using python

I have an audio file and I want to get the timestamps for each word. I want to know during which time period was each the words spoken.
(For example if an audio file says "I am a doctor" I want to know during which instant "I" was said, "am" was said and so on)
I want to do this using python.
I have tried the following code.
from SimpleAudioIndexer import SimpleAudioIndexer as sai
indexer = sai(mode="ibm", src_dir="D:/Codes/Python/audio recognition",
username_ibm="", password_ibm="")
indexer.index_audio(basename = "target.wav")
indexer.save_indexed_audio("{}/indexed_audio".format(indexer.src_dir))
indexer.load_indexed_audio("{}/indexed_audio.txt".format(indexer.src_dir))
print(indexer.get_timestamps())
However I am running into following error.
Traceback (most recent call last):
File "D:\Codes\Python\audio recognition\rec.py", line 5, in <module>
indexer.index_audio(basename = "target.wav")
File "C:\Users\Awais\AppData\Roaming\Python\Python37\site-
packages\SimpleAudioIndexer\__init__.py", line 1108, in index_audio
self._index_audio_ibm(*args, **kwargs)
File "C:\Users\Awais\AppData\Roaming\Python\Python37\site-
packages\SimpleAudioIndexer\__init__.py", line 928, in _index_audio_ibm
replace_already_indexed=replace_already_indexed)
File "C:\Users\Awais\AppData\Roaming\Python\Python37\site-
packages\SimpleAudioIndexer\__init__.py", line 730, in _prepare_audio
self._filtering_step(basename)
File "C:\Users\Awais\AppData\Roaming\Python\Python37\site-
packages\SimpleAudioIndexer\__init__.py", line 638, in _filtering_step
universal_newlines=True).communicate()
File "C:\Program Files (x86)\Microsoft Visual
Studio\Shared\Python37_64\lib\subprocess.py", line 800, in __init__
restore_signals, start_new_session)
File "C:\Program Files (x86)\Microsoft Visual
Studio\Shared\Python37_64\lib\subprocess.py", line 1207, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
From what I can tell from your code/errors is that you're running Windows, but you're using forward slashes "/" in your src_dir string. This won't work as Windows uses the backslash "\" when navigating folders. Such as:
C:\Windows
while many Unix based systems use the forward slash like this:
/home/Awais
In your code you should try to change the "/" to "\" and see if that makes a difference.
If it is your intention on using this program on both Windows and Unix systems, you should use python3's "pathlib" to ensure your directory paths work on either OS. Here is a link that you can use to learn more about handling paths in python3:
https://medium.com/#ageitgey/python-3-quick-tip-the-easy-way-to-deal-with-file-paths-on-windows-mac-and-linux-11a072b58d5f

is there a way to use shell script inside python with subprocess.call()

i can't find solution for this problem code below:
import subprocess
subprocess.call(['./eu_presun.sh'])
shell script is in the same dir as main.py i will use python then i want use this shell script
I'm getting this error.
Traceback (most recent call last):
File "~/_main.py", line 304, in <module>
subprocess.call(['sh eu_presun.sh'])
File "/usr/lib/python3.8/subprocess.py", line 340, in call
with Popen(*popenargs, **kwargs) as p:
File "/usr/lib/python3.8/subprocess.py", line 854, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib/python3.8/subprocess.py", line 1702, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: './eu_presun.sh'
okey im bit tired
answer is
subprocess.call(['./eu_presun.sh']**,shell=True**)
also i have problems with this address and i had to add full path

Segmentation fault (core dumped) while calling python script from NodeJS through spawn

I have python script which prints out long list through statistical R (by PypeR). This python script is working absolutely fine.
Now I am trying to run this script from NodeJS through spawn functionality of child_process but it fails with following error:-
Traceback (most recent call last):
File "pyper_sample.py", line 5, in <module>
r=R()
File "/home/mehtam/pyper.py", line 582, in __init__
'prog' : Popen(RCMD, stdin=PIPE, stdout=PIPE, stderr=return_err and _STDOUT or childstderr, startupinfo=info),
File "/usr/lib64/python2.6/subprocess.py", line 642, in __init__
errread, errwrite)
File "/usr/lib64/python2.6/subprocess.py", line 1234, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
./temp.sh: line 1: 27500 Segmentation fault (core dumped) python pyper_sample.py o1dn01.tsv cpu_overall
child process exited with code : 139
Note: My python script is working perfectly. I already tested it manually.
My python script is working perfectly. I already tested it manually.
The output clearly shows that OSError: No such file or directory exception happened during Popen() call.
It means that the program is not found e.g.,
>>> from subprocess import Popen
>>> p = Popen(["ls", "-l"]) # OK
>>> total 0
>>> p = Popen(["no-such-program-in-current-path"])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1249, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
Also, passing the whole command as a string instead of a list (shell=False by default) is a common error:
>>> p = Popen("ls -l")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1249, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
Make sure:
your (child) program can be found in current $PATH
use a list argument instead of a string
test whether it works if you run it manually from a different working directory, different user, etc
Note: your Popen() call passes startupinfo that is Windows only. A string command with several arguments that would work on Windows fails with the "No such file or directory" error on Unix.

Resources