I'm working on a blockchain project and have to get a script to run on ganache-cli. However, every time I try to run it, I get this error:
File "C:\Users\trifo.local\pipx\venvs\eth-brownie\lib\site-packages\brownie_cli_main_.py", line 64, in main
importlib.import_module(f"brownie.cli.{cmd}").main()
File "C:\Users\trifo.local\pipx\venvs\eth-brownie\lib\site-packages\brownie_cli\run.py", line 45, in main
network.connect(CONFIG.argv["network"])
File "C:\Users\trifo.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\network\main.py", line 50, in connect
rpc.launch(active["cmd"], **active["cmd_settings"])
File "C:\Users\trifo.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\network\rpc_init.py", line 76, in launch
self.process = self.backend.launch(cmd, **kwargs)
File "C:\Users\trifo.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\network\rpc\ganache.py", line 70, in launch
ganache_version = get_ganache_version(cmd_list[0])
File "C:\Users\trifo.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\network\rpc\ganache.py", line 111, in get_ganache_version
ganache_version_proc = psutil.Popen([ganache_executable, "--version"], stdout=PIPE)
File "C:\Users\trifo.local\pipx\venvs\eth-brownie\lib\site-packages\psutil_init_.py", line 1316, in init
self.__subproc = subprocess.Popen(*args, **kwargs)
File "C:\Users\trifo\anaconda3\envs\blockchain\lib\subprocess.py", line 951, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\trifo\anaconda3\envs\blockchain\lib\subprocess.py", line 1420, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified
All the code that I need (node.js, ganache-cli, etc) is already loaded but I cannot figure out what I am doing wrong. If it is a problem with my .env file, something I might not have installed correctly, or something else. Any advice would be helpful.
What I have tried so far includes reinstalling ganache-cli, and changing my .env values in case one was wrong
Related
import sys
import subprocess
def generateFiles(numFiles):
for i in range(0,numFiles):
postfixDir = str(i)
subprocess.check_call(['mkdir','example' + postfixDir])
return
def main():
numFiles = int(sys.argv[1])
generateFiles(numFiles)
main()
after i enter commandline python .\batchingCommands.py 5
it showing the following erros:
PS E:\Projects\Python_Projects\Python_Automation\Scripts> python .\batchingCommands.py 5
Traceback (most recent call last):
File "E:\Projects\Python_Projects\Python_Automation\Scripts\batchingCommands.py", line 13, in <module>
main()
File "E:\Projects\Python_Projects\Python_Automation\Scripts\batchingCommands.py", line 11, in main
generateFiles(numFiles)
File "E:\Projects\Python_Projects\Python_Automation\Scripts\batchingCommands.py", line 6, in generateFiles
subprocess.check_call(['mkdir','example' + postfixDir])
File "E:\Development_tools\Python39\lib\subprocess.py", line 368, in check_call
retcode = call(*popenargs, **kwargs)
File "E:\Development_tools\Python39\lib\subprocess.py", line 349, in call
with Popen(*popenargs, **kwargs) as p:
File "E:\Development_tools\Python39\lib\subprocess.py", line 951, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "E:\Development_tools\Python39\lib\subprocess.py", line 1420, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified
i'm trying to create directory automatically
Python is telling you it asked the operating system to run the program mkdir, which doesn't exist. Unlike in unix, mkdir isn't an actual program on Windows - it's built into powershell and command.com themselves.
To instruct python to run the given command as arguments to a shell - instead of a raw program - use the shell kwarg.
>>> subprocess.check_call(['mkdir', 'foo'], shell=True)
0
I've been trying to use OpenAI's whisper to transcribe some text.
Whenever I run, I get a FileNotFounderror.
My code is as follows:
import whisper
import os
print(os.listdir())
# f = open('test_text.txt', 'r')
# content = f. read()
# print(content)
# f. close()
audio = 'Users/geoff/Downloads/micro-machines.wav'
model = whisper.load_model("tiny")
result = model.transcribe('micro-machines.wav', fp16=False)
print(result['text'])
The commented out part with the opening of the text file was done as a test and runs each time without issue.
When the code prints the directory, I get the following correct list of files, But then the error follows immediarely after:
['.idea', 'main.py', 'micro-machines.wav', 'test_text.txt', 'venv']
Traceback (most recent call last):
File "C:\Users\geoff\PycharmProjects\pythonProject3\main.py", line 16, in <module>
result = model.transcribe('micro-machines.wav', fp16=False)
File "C:\Users\geoff\PycharmProjects\pythonProject3\venv\lib\site-packages\whisper\transcribe.py", line 82, in transcribe
mel = log_mel_spectrogram(audio)
File "C:\Users\geoff\PycharmProjects\pythonProject3\venv\lib\site-packages\whisper\audio.py", line 111, in log_mel_spectrogram
audio = load_audio(audio)
File "C:\Users\geoff\PycharmProjects\pythonProject3\venv\lib\site-packages\whisper\audio.py", line 42, in load_audio
ffmpeg.input(file, threads=0)
File "C:\Users\geoff\PycharmProjects\pythonProject3\venv\lib\site-packages\ffmpeg\_run.py", line 313, in run
process = run_async(
File "C:\Users\geoff\PycharmProjects\pythonProject3\venv\lib\site-packages\ffmpeg\_run.py", line 284, in run_async
return subprocess.Popen(
File "C:\Users\geoff\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 966, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\geoff\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 1435, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified
There seems to be a mismatch in the file paths you've used for the commented part as observed from the output:
C:\Users\geoff\ PycharmProjects \ pythonProject3
and the following part.
audio = 'Users/geoff/Downloads/micro-machines.wav'
You may verify where the .wav file exists - in 'Downloads' or in 'pythonProject3' folder and try again.
I am using PyCharm to run simple pyflink latest 1.13 example (it is only two lines). But the get_gateway() method is not working.
For the interpreter I created virtual environment and use it in my PyCharm project. I also downloaded Java8.
I tried many steps to solve the issue but
from pyflink.common.serialization import Encoder
from pyflink.common.typeinfo import Types
from pyflink.datastream import StreamExecutionEnvironment
from pyflink.datastream.connectors import StreamingFileSink
def print_hi(name):
# Use a breakpoint in the code line below to debug your script.
print(f'Hi, {name}') # Press Ctrl+F8 to toggle the breakpoint.
env = StreamExecutionEnvironment.get_execution_environment()
env.set_parallelism(1)
C:\Users\myuser\AppData\Local\Programs\Python\Python38\myvenv\Scripts\python.exe C:/Users/myuser/PycharmProjects/pythonProject3/main.py
Hi, PyCharm
Traceback (most recent call last):
File "C:/Users/myuser/PycharmProjects/pythonProject3/main.py", line 19, in <module>
print_hi('PyCharm')
File "C:/Users/myuser/PycharmProjects/pythonProject3/main.py", line 13, in print_hi
env = StreamExecutionEnvironment.get_execution_environment()
File "C:\Users\myuser\AppData\Local\Programs\Python\Python38\myvenv\lib\site-packages\pyflink\datastream\stream_execution_environment.py", line 688, in get_execution_environment
gateway = get_gateway()
File "C:\Users\myuser\AppData\Local\Programs\Python\Python38\myvenv\lib\site-packages\pyflink\java_gateway.py", line 62, in get_gateway
_gateway = launch_gateway()
File "C:\Users\myuser\AppData\Local\Programs\Python\Python38\myvenv\lib\site-packages\pyflink\java_gateway.py", line 106, in launch_gateway
p = launch_gateway_server_process(env, args)
File "C:\Users\myuser\AppData\Local\Programs\Python\Python38\myvenv\lib\site-packages\pyflink\pyflink_gateway_server.py", line 221, in launch_gateway_server_process
return Popen(command, stdin=PIPE, preexec_fn=preexec_fn, env=env)
File "C:\Users\myuser\AppData\Local\Programs\Python\Python38\lib\subprocess.py", line 858, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\myuser\AppData\Local\Programs\Python\Python38\lib\subprocess.py", line 1311, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified
See similar question here for description: https://stackoverflow.com/a/71840491/272023
JAVA_HOME was not pointing to a valid Java installation.
I'm trying to port the Proton-VPN Linux CLI (https://github.com/ProtonVPN/linux-cli) to Windows and have had decent success so far, but I'm running into an issue with [subprocess.Popen()]. I've tried many fixes but none have worked so far. I've tried converting this:
with open(os.path.join(CONFIG_DIR, "ovpn.log"), "w+") as f:
subprocess.Popen(
[
"openvpn",
"--config", OVPN_FILE,
"--auth-user-pass", PASSFILE,
"--dev", "proton0",
"--dev-type", "tun"
],
stdout=f, stderr=f
)
which is from the original module, to this:
file_name = os.path.join(CONFIG_DIR, "ovpn.log")
print(file_name)
with open(file_name, "w+") as f:
subprocess.Popen([
"openvpn",
"--config", OVPN_FILE,
"--auth-user-pass", PASSFILE,
"--dev", "proton0",
"--dev-type", "tun"
], stdout=f, stderr=f)
which both yield the same error:
Traceback (most recent call last):
File "c:\users\<user>\appdata\local\programs\python\python39\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\users\<user>\appdata\local\programs\python\python39\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Users\<user>\AppData\Local\Programs\Python\Python39\Scripts\protonvpn.exe\__main__.py", line 7, in <module>
File "c:\users\<user>\appdata\local\programs\python\python39\lib\site-packages\protonvpn_cli\cli.py", line 73, in main
cli()
File "c:\users\<user>\appdata\local\programs\python\python39\lib\site-packages\protonvpn_cli\cli.py", line 114, in cli
connection.fastest(protocol)
File "c:\users\<user>\appdata\local\programs\python\python39\lib\site-packages\protonvpn_cli\connection.py", line 163, in fastest
openvpn_connect(fastest_server, protocol)
File "c:\users\<user>\appdata\local\programs\python\python39\lib\site-packages\protonvpn_cli\connection.py", line 463, in openvpn_connect
subprocess.Popen([
File "c:\users\<user>\appdata\local\programs\python\python39\lib\subprocess.py", line 947, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "c:\users\<user>\appdata\local\programs\python\python39\lib\subprocess.py", line 1416, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified
Anyone able to help me? I've been struggling all day with this and have been unable to find a fix. (by the way, I'm very new to python)
Edit: Upon trying to print "f" from the original module it returns this - "<_io.TextIOWrapper name='C:\Users\\.pvpn-cli\ovpn.log' mode='w+' encoding='cp1252'>". I tried inputting the name into an explorer tab and I received an error, but upon removing the double slashes I was taken to the file. I'm quite certain the double slashes are supposed to be there but could this be the problem?
I'm trying to sound process a wav file with python and pysndfx but getting this weird error. I've tried many different path formats and many different paths. Even thought os.path.isfile() returns true it still comes up with this error. Any help would be greatly appreciated.
from pysndfx import AudioEffectsChain
import os
in_file = os.getcwd() + "\\" + "a.mp3"
in_file = in_file.replace("\\", "//")#tried many things here, tried to it without any replacing
if os.path.isfile(in_file):
print("fileyes") #This returns true
else:
print("not a file")
print(in_file)
fs = 44100
fx = (AudioEffectsChain().
reverb().
delay().
phaser()
)
fx(in_file,"apro.mp3")
Here's the error
fileyes
E://PyEarTraning//Test//a.mp3
Traceback (most recent call last):
File "e:/PyEarTraning/Test/test.py", line 28, in <module>
fx(in_file,"E:\\PyEarTraning\\Test\\apro.mp3")
File "C:\Program Files (x86)\Python38-32\lib\site-packages\pysndfx\dsp.py", line 368, in __call__
infile = FilePathInput(src)
File "C:\Program Files (x86)\Python38-32\lib\site-packages\pysndfx\sndfiles.py", line 29, in __init__
stdout, stderr = Popen(shlex.split(info_cmd, posix=False),
File "C:\Program Files (x86)\Python38-32\lib\subprocess.py", line 854, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Program Files (x86)\Python38-32\lib\subprocess.py", line 1307, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified
I can't comment (yet) so i'll ask here. Do you have your file in the same directory (folder) as the python program? If not then it won't work even if the file does actually exist somewhere. Try to copy or move both your file and program code into a new/the same folder.