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.
Related
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 am running this code in a debian/jessie box:
from elaphe import barcode
text = 'hello world in barcode'
bc = barcode('pdf417', text, options = dict(
compact = False, eclevel = 5, columns = 13,
rowmult = 2, rows = 3),
margin=20, scale=1)
After running this, I execute the following:
bc.save('filename.png')
And then get the following error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/dist-packages/PIL/Image.py", line 1653, in save
self.load()
File "/usr/lib/python2.7/dist-packages/PIL/EpsImagePlugin.py", line 336, in load
self.im = Ghostscript(self.tile, self.size, self.fp, scale)
File "/usr/lib/python2.7/dist-packages/PIL/EpsImagePlugin.py", line 143, in Ghostscript
stdout=subprocess.PIPE)
File "/usr/lib/python2.7/subprocess.py", line 710, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1335, in _execute_child raise child_exception OSError: [Errno 2]
No such file or directory
If I run the same code in an ubuntu 14.04 box, there is no such error and works fine. Since I saw this error appearing in several post, and with lots of packages, I can conclude that it's something related to debian and not to the code itself, not even to elaphe python package.
It would be desirable to find if there is some kind of path to redefine or symlink somewhere, or if there is a patch for this.
Please help.
The error message is not super clean. But it might be caused by missing ghostscript package.
try:
sudo apt-get install ghostscript
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'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?)
I am working with WARC Tools, a python library for working with WARC files. I've installed everything and it all seems to work except for the last command. While I suspect many of you may not have worked with this tool, perhaps you can make sense of the error message for me.
When I run this command:
python /path/filesdump.py filtered.warc as per the documentation, I get this error message immediately:
html/811cac8c-7430-403b-96a4-7d77137b0d46.html
Traceback (most recent call last):
File "/users/ianmilligan1/desktop/warc/warc-tools-mandel/filesdump.py", line 63, in <module>
sys.exit(main(sys.argv))
File "/users/ianmilligan1/desktop/warc/warc-tools-mandel/filesdump.py", line 34, in main
dump_archive(fh,name)
File "/users/ianmilligan1/desktop/warc/warc-tools-mandel/filesdump.py", line 57, in dump_archive
txt = record.filedump(content=True)
File "/Users/ianmilligan1/Desktop/WARC/warc-tools-mandel/warctools/record.py", line 140, in filedump
p = Popen(['lynx', '-dump', '-stdin', '-nomargins', '-unique_urls', '-width=120'], stdout=PIPE, stdin=PIPE, stderr=STDOUT)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 679, in __init__
errread, errwrite)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1228, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
What's going on here? Where would you suggest I begin looking?
You need to install lynx, a command-line web browser that WARC Tools seems to require. That'll solve it.
What's going on is that warctools/record.py is calling lynx on line 140, and Python's subprocess library isn't finding the lynx executable so it throws an exception. They really ought to wrap the exception and provide a clearer message... Anyways. Try that and see if it fixes it.