I'm working with a set of scripts aimed at modifying an android app, the github repo located here: Ingress Broot Mod. I installed Python 3.2, then installed PyYAML 3.10. I moved on to follow the build instructions and "Import Ingress apk using import_apk.py script."
Specifically, I typed: B:\GitHub\ingress-apk-mod\bin>python import_apk.py "B:\com.nianticproject.ingress-1.apk"
At which point this error pops up.
Traceback (most recent call last):
File "B:\GitHub\ingress-apk-mod\bin\import_apk.py", line 28, in <module>
main(sys.argv[1])
File "B:\GitHub\ingress-apk-mod\bin\import_apk.py", line 24, in main
''' % (LINE_PREFIX, apk), shell=True, executable='/bin/bash')
File "C:\Python32\lib\subprocess.py", line 483, in check_call
retcode = call(*popenargs, **kwargs)
File "C:\Python32\lib\subprocess.py", line 470, in call
return Popen(*popenargs, **kwargs).wait()
File "C:\Python32\lib\subprocess.py", line 744, in __init__
restore_signals, start_new_session)
File "C:\Python32\lib\subprocess.py", line 977, in _execute_child
startupinfo)
WindowsError: [Error 3] The system cannot find the path specified
The closest I could find was Unable to run call subprocess method using python 3.2.
Is this an easy fix; if not, what steps should I take to fix this problem?
This is my first time using python - could this possibly stem from improperly installed Python (did I miss a step?)
Related
I'm trying to run the tests for the contract from this tutorial, https://docs.elrond.com/developers/tutorials/your-first-dapp/, but I'm stumbling upon the below error when running erdpy contract test
INFO:projects.core:run_tests.project: /home/mccuna/repos/elrond/adder/adder
INFO:myprocess:run_process: ['/home/mccuna/elrondsdk/vmtools/mandos-test', '/home/mccuna/repos/elrond/adder/adder/mandos'], in folder: None
Traceback (most recent call last):
File "/home/mccuna/elrondsdk/erdpy-venv/bin/erdpy", line 8, in <module>
sys.exit(main())
File "/home/mccuna/elrondsdk/erdpy-venv/lib/python3.8/site-packages/erdpy/cli.py", line 32, in main
_do_main()
File "/home/mccuna/elrondsdk/erdpy-venv/lib/python3.8/site-packages/erdpy/cli.py", line 58, in _do_main
args.func(args)
File "/home/mccuna/elrondsdk/erdpy-venv/lib/python3.8/site-packages/erdpy/cli_contracts.py", line 171, in run_tests
projects.run_tests(args)
File "/home/mccuna/elrondsdk/erdpy-venv/lib/python3.8/site-packages/erdpy/projects/core.py", line 65, in run_tests
project.run_tests(directory, wildcard)
File "/home/mccuna/elrondsdk/erdpy-venv/lib/python3.8/site-packages/erdpy/projects/project_base.py", line 106, in run_tests
myprocess.run_process(args, env=tool_env)
File "/home/mccuna/elrondsdk/erdpy-venv/lib/python3.8/site-packages/erdpy/myprocess.py", line 19, in run_process
output = subprocess.check_output(args, shell=False, universal_newlines=True, stderr=subprocess.STDOUT, env=env, cwd=cwd)
File "/usr/lib/python3.8/subprocess.py", line 415, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "/usr/lib/python3.8/subprocess.py", line 493, in run
with Popen(*popenargs, **kwargs) as process:
File "/usr/lib/python3.8/subprocess.py", line 858, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib/python3.8/subprocess.py", line 1704, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/home/mccuna/elrondsdk/vmtools/mandos-test'
I've searched for a way to install mandos-test, but couldn't find anything useful. What am I missing?
TLDR: if running in a WSL environment, that might be the issue.
Ok, I've managed to side-fix the issue.
Initially, I was running Windows 10 and Ubuntu 20.04 using WSL2. After trying various solutions (e.g.: updates, reinstalling dependencies etc.) I've given up. I've removed the Ubuntu 20.04 WSL2 environment and instead went for having an actual Ubuntu 20.04 installation, alongside Windows 10 and dual booting between them. Everything ran smoothly in the new, standalone, Ubuntu environment. My guess is that some dependencies are either not installed or not properly configured in a WSL2 environment, but considering my current erdpy & elrond tech stack experience, I cannot confirm or pinpoint the exact root cause.
I am new to python scripting. I am trying to run subprocess methods on Python Idle and getting these errors:
import subprocess
subprocess.check_output("ls")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\ramakrishna\AppData\Local\Programs\Python\Python36\lib\subprocess.py", line 336, in check_output
**kwargs).stdout
File "C:\Users\ramakrishna\AppData\Local\Programs\Python\Python36\lib\subprocess.py", line 403, in run
with Popen(*popenargs, **kwargs) as process:
File "C:\Users\ramakrishna\AppData\Local\Programs\Python\Python36\lib\subprocess.py", line 707, in __init__
restore_signals, start_new_session)
File "C:\Users\ramakrishna\AppData\Local\Programs\Python\Python36\lib\subprocess.py", line 990, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
Please help me out to resolve this error.
Thank you
seems like you are running windows. Windows has no "ls" command, so you get a FileNotFoundError exception. I am not familiar with windows and python, but try "dir" instead of "ls", that should work.
I have been trying to install the mlabwrap Python library, but keep on running into the following error when I run the setup.py file using the command python setup.py install in the terminal:
Traceback (most recent call last):
File "setup.py", line 130, in <module>
queried_version, queried_dir, queried_platform_dir = matlab_params(cmd, WINDOWS, extra_args)
File "setup.py", line 93, in matlab_params
error = call(cmd, **extra_args)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 522, in call
return Popen(*popenargs, **kwargs).wait()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 710, in __init__
errread, errwrite)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1335, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
I have done some investigation, and found the following forum post: https://sourceforge.net/p/mlabwrap/mailman/message/29077359/ to resolve the issue. Following the advice in this thread, I changed the following things in the setup.py file:
__version__ = '7.3'
and
MATLAB_DIR = '/Applications/MATLAB_R2015a.app'
I have a feeling that the problem is related to finding the directory that matlab is located in, but I seem to be unable to resolve this. I didn't change my $PATH variable because I was a little confused by the advice given in the thread. Any insight would be much appreciated!
In order to install mlabwrap, you must modify the setup.py file to:
MATLAB_COMMAND = '/Applications/MATLAB_R2015a.app/bin/matlab' # specify a full path if not in PATH
MATLAB_VERSION = 7.3 # e.g: 6 (one of (6, 6.5, 7, 7.3))
# 7.3 includes later versions as well
MATLAB_DIR= '/Applications/MATLAB_R2015a.app/' # e.g: '/usr/local/matlab'; 'c:/matlab6'
PLATFORM_DIR='maci64' # e.g: 'glnx86'; r'win32/microsoft/msvc60'
EXTRA_COMPILE_ARGS=None # e.g: ['-G']
The parameters may change depending on what version of MATLAB you are using and what operating system you are using.
I need to create a python script that runs a file gams (myfile.gms).
My file is in a folder F:\Otim\correct, so I was using a part of a code that I saw in this forum. I made:
import subprocess
subprocess.check_call(["F:\Otim\correct\myfile.gms"])
and I get an error:
Runtime error
Traceback (most recent call last):
File "<string>", line 80, in <module>
File "C:\Python27\ArcGIS10.2\Lib\subprocess.py", line 506, in check_call retcode = call(*popenargs, **kwargs)
File "C:\Python27\ArcGIS10.2\Lib\subprocess.py", line 493, in call return Popen(*popenargs, **kwargs).wait()
File "C:\Python27\ArcGIS10.2\Lib\subprocess.py", line 679, in __init__errread, errwrite)
File "C:\Python27\ArcGIS10.2\Lib\subprocess.py", line 896, in _execute_child
startupinfo)
WindowsError: [Error 193] %1 is not a valid Win32 application
Can someone help me please? Thanks
I've never used gams but after a quick look at www.gams.com it sounds like myfile.gms is not the file to be executed but the input file to be given as argument to the gams executable.
So you should try something like :
import subprocess
subprocess.check_call([r"C:\path\to\programs\GAMS.exe",r"F:\Otim\correct\myfile.gms"])
Notice : there is a GAMS python API which could give you a more portable solution.
I am trying to build adblockplus from this link. When I issue the command:
python build.py build
I end up getting the following error message. I tried with and without sudo to no avail.
Traceback (most recent call last):
File "build.py", line 10, in <module>
buildtools.build.processArgs('.', sys.argv)
File "/home/machine/projects/weird/buildtools/build.py", line 352, in processArgs
commands[command](baseDir, scriptName, opts, args, type)
File "/home/machine/projects/weird/buildtools/build.py", line 39, in __call__
return self._handler(baseDir, scriptName, opts, args, type)
File "/home/machine/projects/weird/buildtools/build.py", line 166, in runBuild
limitMetadata=limitMetadata)
File "/home/machine/projects/weird/buildtools/packager.py", line 274, in createBuild
buildNum = getBuildNum(baseDir)
File "/home/machine/projects/weird/buildtools/packager.py", line 80, in getBuildNum
(result, dummy) = subprocess.Popen(['hg', 'id', '-n'], stdout=subprocess.PIPE).communicate()
File "/usr/lib/python2.6/subprocess.py", line 623, in __init__
errread, errwrite)
File "/usr/lib/python2.6/subprocess.py", line 1141, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
Am I missing a package? Any hint on what the problem could be will be much appreciated.
The stack trace makes it clear that the issue is caused by the following line:
(result, dummy) = subprocess.Popen(['hg', 'id', '-n'], stdout=subprocess.PIPE).communicate()
If you look at the subprocess package documentation, this line is trying to run the hg id -n command (get numerical Mercurial revision). Apparently, the Mercurial command line tool isn't present on your system (a possibility that this build script didn't consider) so it fails.
Disclaimer: I happen to be the one who wrote this script and I fixed this bug now. Mercurial isn't essential for the build, the revision number is pretty much only necessary to determine the output file name.