I'm trying to setup elaphe on Mac. When I try generate some barcode using the terminal, with command python + /.../file.py elaphe works OK and generates the barcode correctly. But when I try to execute through web (php) I get the following error in the Apache's error logs:
Traceback (most recent call last):
File "lib/barcode_generator/generator.py", line 19, in <module>
code_39_image.save(str(random)+'.tif')
File "/Users/x/Library/Python/2.7/lib/python/site-packages/PIL/Image.py", line 1406, in save
self.load()
File "/Users/x/Library/Python/2.7/lib/python/site-packages/PIL/EpsImagePlugin.py", line 283, in load
self.im = Ghostscript(self.tile, self.size, self.fp)
**File "/Users/x/Library/Python/2.7/lib/python/site-packages/PIL/EpsImagePlugin.py", line 72, in Ghostscript
gs.write(s)**
If I were in Windows I would say it is a problem with the path and the program can't find the "gs.write" but in Mac I'm a rookie, I don't know if it's the same, nevertheless I've already include this 2 path:
export PATH=/Users/x/Library/Python/2.7/bin:$PATH
export PATH=/usr/local/bin:$PATH
I would appreciate can give some ideas regarding this error.
Thanks in advance.
Fixed via a symbolic link. Clearly was a PATH issue or hardcoded reference to the gs binary.
sudo ln -s /usr/local/bin/gs /usr/bin/gs
Related
I made an exe to read images including gifs using pyinstaller. However, the exe can't read gif and the below error occurs. I have installed the latest version of imageio and the program works in interpreter. Could you advise? Thanks in advance.
The line raising error:
cv_gif = imageio.mimread(pic_path)
Error:
Traceback (most recent call last):
File "Image Viewer.py", line 3085, in <module>
File "Image Viewer.py", line 522, in go
File "Image Viewer.py", line 1264, in ShowANI
File "imageio\core\functions.py", line 247, in mimread
File "imageio\core\imopen.py", line 277, in imopen
ValueError: Could not find a backend to open `C:\Users\simon\Practice\testdir3\alpaca.gif`` with iomode `rI`.
Based on the extension, the following plugins might add capable backends:
pillow: pip install imageio[pillow]
GIF-PIL: pip install imageio[pillow]
I have exactly the same problem.
This might have something to do with the new feature of imageio introduced in version 2.11.0: Choose plugin based on extension and plugin lazy-import. Revert back to 2.10.5 solves the problem.
Just manually copied the folder \Lib\site-packages\imageio and replaced the imagoio folder of the exe, then it works.
python 2.7. Notepad++. Windows 10
I'm trying to open file like this:
sourcefile=raw_input('name of the file: ')
fhand=open(sourcefile,'r')
And it gives me this error:
Traceback (most recent call last):
File "C:\Users\Denis\Desktop\prog\python\es.py", line 135, in <module>
fhand=open(sourcefile)
IOError: [Errno 2] No such file or directory: '20.04.2016.csv'
In notepad++ i run this: C:\Python27\python.exe -i "$(FULL_CURRENT_PATH)"
Kinda new to programming but i'm guesing that I have to specify somehow path to the place where my es.py and my file is. I thought $(FULL_CURRENT_PATH) does it.
If i run my code with python or idle it works fine.
I've tried to run this program in Atom, gives same mistake. No mistakes so long as I don't work with files.
I have installed robotframework-ride on two PCs of mine. Everything works fine on one PC but could not have RIDE running on other PC.
I have the following installed on both PCs
- Python 2.7.8 on win32
- Robot framework 2.8.6
- wxPython 2.8.12.1
- robotframeowkr-ride-1.4.1b
When I tried to execute "python ride.py" on the second PC, I got a message:
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\robotide__init__.py", line 74, in main
run(inpath, not noupdatecheck, debug_console)
File "C:\Python27\lib\site-packages\robotide__init_.py", line 100, in run
ride = RIDE(inpath, updatecheck)
File "C:\Python27\lib\site-packages\robotide\application\application.py", line
41, in __init_
wx.App.init(self, redirect=False)
File "C:\Python27\lib\site-packages\wx-2.8-msw-unicode\wx_core.py", line 7981
, in init
self.BootstrapApp()
File "C:\Python27\lib\site-packages\wx-2.8-msw-unicode\wx_core.py", line 7555
, in _BootstrapApp
return _core.PyApp__BootstrapApp(args, *kwargs)
File "C:\Python27\lib\site-packages\robotide\application\application.py", line
49, in OnInit
self.namespace = Namespace(self.settings)
File "C:\Python27\lib\site-packages\robotide\namespace\namespace.py", line 41,
in init
self._set_pythonpath()
File "C:\Python27\lib\site-packages\robotide\namespace\namespace.py", line 62,
in _set_pythonpath
self._settings.get('installed robot version', None))
File "C:\Python27\lib\site-packages\robotide\namespace\robotlibraryloader.py",
line 35, in find_installed_robot_libraries
rf_file, rf_version = output.strip().split(', ')
ValueError: too many values to unpack
Use --help to get usage information.
Something more interesting is, if I uninstall robot framework from the second PC, I could execute "python ride.py" but of course there is no point doing this.
Anyone can help me out here?
With kind assistance from janne, I have solved this problem. The cause is for the first PC I installed the correct "robotframework", but for the second PC I managed to install a wrong module, "robot" instead of "robotframework". That was why RIDE was not working.
I am sorry for making such a silly mistake. A big thank you to janne for his help.
should use: pip install robotframework
should NOT use: pip install robot
I am working on a simple webapp from Head First Python. I am using ubuntu 14.04. But it is the error:
Traceback (most recent call last):
File "/usr/lib/python3.4/http/server.py", line 1143, in run_cgi
os.execve(scriptfile, args, env)
FileNotFoundError: [Errno 2] No such file or directory:
'/home/sarthak/Desktop/Learn/HeadFirstPython/chapter7/webapp/cgi-bin/generate_list.py'
127.0.0.1 - - [12/Jun/2015 07:08:25] CGI script exit status 0x7f00
The file surely exists on the system and it is made executable.
How to fix the problem?
The Problem lies in the 'wrong' path of the shebang line (the first line which says #!/usr/local/bin/python3) of the generate_list.py file.
If you are using ubuntu the location of python3 is probably /usr/bin/python3 (You can find out your python3 location by typing which python3 into the shell/terminal). So you have to adjust the first line to the actual address of python3 in order to make your script work.
I am trying to use pyinstaller 2.0 to build an .exe file from a python script which uses matplotlib and numpy, but I keep failing. I tried this code from
Building python pylab/matplotlib exe using pyinstaller
as a simple reference, I get the build done for me, but when I run the exe I get the error:
Traceback (most recent call last):
File "<string>", line 12, in <module>
File "C:\Compilations\pyinstaller-2.0\PyInstaller\loader\iu.py", line 386, in
importHook
mod = _self_doimport(nm, ctx, fqname)
File "C:\Compilations\pyinstaller-2.0\PyInstaller\loader\iu.py", line 480, in
doimport
exec co in mod.__dict__
File "C:\Compilations\pyinstaller-2.0\ptest\build\pyi.win32\ptest\out00-PYZ.py
z\PIL.PpmImagePlugin", line 27, in <module>
LookupError: no codec search functions registered: can't find encoding
Is this a bug or do I need to tinker with the .spec file and link the matplotlib libraries to pyinstaller somehow? If so - can anyone show me a simple example, please?
I tried cx_Freeze before and also seem to have a problem as soon as I use a code with matplotlib.
Thanks in advance!
Edit PpmImagePlugin.py and add 'import encodings' (without the quotes) before any other imports. I had the same problem and this fixed it. Source: http://www.pyinstaller.org/ticket/651