I'm using Python on my Centos machine and when I try to run my program I have this error displayed :
Running setup.py egg_info for package pyepr
Traceback (most recent call last):
File "<string>", line 16, in <module>
File "/tmp/pip-build-root/pyepr/setup.py", line 68, in <module>
print('using EPR C API sources at "{}"'.format(eprsrcdir))
ValueError: zero length field name in format
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 16, in <module>
File "/tmp/pip-build-root/pyepr/setup.py", line 68, in <module>
print('using EPR C API sources at "{}"'.format(eprsrcdir))
ValueError: zero length field name in format
I have already checked the other questions about this subject and I already installed Python 2.7.6 and set it as my default configuration as shown below....
$ python -V
Python 2.7.6
Something must have gone wrong, but I don't know what.
Anybody has an idea?
Thanks
That error can only be raised if you run that code with Python 2.6 or older. In those versions, you must explicitly number the format fields for str.format (starting at 0):
print('using EPR C API sources at "{0}"'.format(eprsrcdir))
Of course, this is only a temporary fix. It would be better to investigate why your code is not being run with Python 2.7 in the first place and then fix that instead.
If you run an install using sudo, you are going to end up using the sudo path's Python interpreter. Not sure if you are using sudo or not for installing, but there is a good chance you are.
Related
$ python ../any.py
Traceback (most recent call last):
File "../any.py", line 1, in
from py2cytoscape.data.cyrest_client import CyRestClient
File "/home/admin-cbdm/.local/lib/python2.7/site-packages/py2cytoscape/data/cyrest_client.py", line 4, in
from .network_client import NetworkClient
File "/home/admin-cbdm/.local/lib/python2.7/site-packages/py2cytoscape/data/network_client.py", line 12, in
from ..util import util_dataframe as df_util
File "/home/admin-cbdm/.local/lib/python2.7/site-packages/py2cytoscape/util/util_dataframe.py", line 88
row = (source, itr, target, *extra_values)
^
SyntaxError: invalid syntax
Your terminal environment is not the same that you have on pycharm.
Make sure you have the latest Python 3 or Python 2.7.13 on the terminal (which python and start python to make sure you are accessing the correct version) then install py2cytoscape (also make sure you are accessing the corresponding which pip).
i've just installed base65536 in python, found Here
As a test to see if it works, i've made this script here:
import base65536
a = base65536.encode("Hello World")
print a
i'm using python2.7. When i run it, i get this error:
Traceback (most recent call last):
File "test.py", line 3, in <module>
a = base65536.encode("Hello World")
File "C:\Python27\lib\site-packages\base65536\core.py", line 118, in encode
stream.write(unichr(code_point))
ValueError: unichr() arg not in range(0x10000) (narrow Python build)
Any idea what to do here?
Python2 has two builds: one "narrow" and one "wide", depending on Unicode support. It looks like that library doesn't support the "narrow" build. You should install a "wide" build or hope the library gets updated. It looks like someone filed an issue on it: https://github.com/Parkayun/base65536/issues/4
Or you can use a recent version of Python3, which doesn't have this problem.
I successfully installed javabridge using $pip3 install javabridge on my Mac's virtual environment. But when I tried to import javabridge in my python3 code, this is what I get:
import javabridge
Failed to run /usr/libexec/java_home, defaulting to best guess for Java
Traceback (most recent call last):
File "/Users/puifai/Documents/data_science/venv/venv3/lib/python3.6/site-packages/javabridge/locate.py", line 45, in find_javahome
os.path.join(os.path.dirname(path), "Libraries"),
File "/Users/puifai/Documents/data_science/venv/venv3/bin/../lib/python3.6/posixpath.py", line 92, in join
genericpath._check_arg_types('join', a, *p)
File "/Users/puifai/Documents/data_science/venv/venv3/bin/../lib/python3.6/genericpath.py", line 151, in _check_arg_types
raise TypeError("Can't mix strings and bytes in path components") from None
TypeError: Can't mix strings and bytes in path components
Any ideas on how to fix this? It looks like a problem with Python rather than javabridge?
Pardon the less-than-complete answer, but it has to do with the difference in strings between Python2 and Python3. Working in Python2.7 will at least get you around the problem for the moment. See this post for more background.
I am trying to install pysam and pybedtools modules on python 3.4. But I got an Error:
Collecting pysam
Using cached pysam-0.9.0.tar.gz
Complete output from command python setup.py egg_info:
'.' is not recognized as an internal or external command,
operable program or batch file.
# pysam: htslib mode is shared
# pysam: htslib configure options: None
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\ikirov.CLO\AppData\Local\Temp\pip-build-_me_xeme\pysam\setup.py", line 212, in <module>
sys.abiflags)]
AttributeError: 'module' object has no attribute 'abiflags'
Could you please help me with it?
Hi I got the same error last year during one of my class.
As I know back then, pysam simply won't work with python3 + windows environment.
See this: https://github.com/pysam-developers/pysam/issues/353 looks like it is still unsolved now.
For my homework, I just used this http://bow.codeplex.com/
And my suggestion, just try to use linux or get a python2. Yes I know the scientific field is the slowest for the 2->3 transition. It sucks.
I am trying to set up sleepy.mongoose, a mongoDB REST interface using the instructions here.
I am using windows 8, :( ...anyway... I have python 3.3.2 installed and it is accessible from the cmd prompt. I also have pymongo installed, when i enter help('modules') to python, pymongo is on the list of available modules!
But when I try to run python httpd.py from the sleepy.mongoose dir (thanks karthikr), I get an error:
C:\Users\Brook\Desktop\sleepy.mongoose>python httpd.py
Traceback (most recent call last):
File "httpd.py", line 1, in <module>
sleepymongoose/httpd.py
NameError: name 'sleepymongoose' is not defined
Now I tried actually cding into the proper dir, but I get this other error:
C:\Users\Brook\Desktop\sleepy.mongoose\sleepymongoose>python httpd.py
File "httpd.py", line 221
print "\n================================="
^
SyntaxError: invalid syntax
I have had the same problem with Python 2.7 on Windows. Considering 'httpd.py' wich contains only:
sleepymongoose/httpd.py
You need this command line to start it:
python sleepymongoose/httpd.py
You are using python 3 to run python 2 code. The syntax for print amongst other things has changed. Use Python 2 or a server which supports python 3.