I used the following code to open 1.png and got some error:
>>> from PIL import Image
>>> im = Image.open("1.png")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.6/site-packages/PIL/Image.py", line 2519, in open
% (filename if filename else fp))
OSError: cannot identify image file '1.png'
But I can open 1.png successfully with macOS Preview.
I am using Pillow 4.2.1 in Python 3.6.2.
Here is the image file https://www.dropbox.com/s/jbi2io1mb6p9cfi/1.png
When I downloaded your link from Save link as, I downloaded a corrupt file. I couldn't open it from PIL Image, but also not with the Preview app.
When I first opened the file in Chrome, and then clicked Download from Dropbox, the file was not corrupted, and I could also open it successfully in PIL Image.
Related
I'm using ubuntu 16.04 and python files that were using vpython that were working fine before now crash showing
from visual import *
ImportError: No module named visual.
I installed anaconda, still nothing. I launched jupyter notebook on the terminal, it opens on a new window in google chrome. I created a test.py file containing just
import vpython
and it prompts:
Traceback (most recent call last):
File "teste vpython.py", line 1, in <module>
import vpython
File "/home/user/anaconda2/lib/python2.7/site-
packages/vpython/__init__.py", line 10, in <module>
from .vpython import *
File "/home/user/anaconda2/lib/python2.7/site-
packages/vpython/vpython.py", line 507, in <module>
get_ipython().kernel.comm_manager.register_target('glow', GlowWidget)
AttributeError: 'NoneType' object has no attribute 'kernel'
I would appreciate if somebody could help me. I know there are similar tags, but I did as every answer I checked as suggested with no results.
Thank you.
I have Ubuntu 16.04 with Anaconda and Python 3.6. Just now I created another environment that contains Python 2.7. In that environment I did "pip install vpython --upgrade" and verified with "pip show vpython" that the version is indeed 7.0.3. I then executed "jupyter notebook" and demo programs ran fine.
I am puzzled by your comment that you created a test.py file, and by the line that says "File "teste vpython.py", line 1, in ". I would expect a file with the .ipynb extension, so something doesn't seem right.
I'll advertise that a better place to pose VPython questions is in the VPython forum at
https://groups.google.com/forum/?fromgroups&hl=en#!forum/vpython-users
Does anyone know how to undo the changes to paths and permissions wrought by upgrading to El Capitan. Specifically, it appears that OS X is now using the system python instead of my Canopy installation.
These look ok:
Michaels-Mac-mini:~ mellis$ which python
/Users/mellis/Library/Enthought/Canopy_64bit/User/bin/python
Michaels-Mac-mini:~ mellis$ which ipython
/Users/mellis/bin/ipython
But trying to launch ipython fails:
Michaels-Mac-mini:~ mellis$ ipython
Traceback (most recent call last):
File "/Users/mellis/bin/ipython", line 5, in <module>
from pkg_resources import load_entry_point
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/pyth on/pkg_resources.py", line 2793, in <module>
working_set.require(__requires__)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 673, in require
needed = self.resolve(parse_requirements(requirements))
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 576, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: ipython==0.11
A complete update of my installed Canopy packages including ipython seems to have fixed the problem.
A similar question was asked before by someone else: https://stackoverflow.com/questions/23600028/py2app-app-crashes-on-earlier-mac-os-x-versions
I have an app that runs fine on my machine (OSX 10.9.4), but when I move it to another machine running 10.7.5, the app crashes on start up. I get the following messages in console:
Traceback (most recent call last):
File "/PATH_TO_APP/APP.app/Contents/Resources/__boot__.py", line 3
_recipes_pil_prescript(['Hdf5SubImagePlugin', 'FitsStubImagePlugin', 'SunImagePlugin', 'GbrImagePlugin', 'Jpeg2KImagePlugin', 'MicImagePlugin', 'FpxImagePlugin', ImImagePlugin', ...
File "/PATH_TO_APP/APP.app/Contents/Resources/__boot__.py, line 3
from PIL import Image
File "PIL/Image.pyc", line 62, in <module>
File "PIL/_imaging.pyc", line 14, in <module>
File "PIL/_imaging.pyc", line 10, in __load
ImportError: dlopen(/PATH_TO_APP/APP.app/Contents/Resources/lib/python2.7/lib-dynload/PIL/_imaging.so, 2): Symbol not found: ___sincos_stret
Referenced from /PATH_TO_APP/APP.app/Contents/Resources/lib/python2.7/lib-dynload/PIL/_imaging.so
Expected in: /usr/lib/libSystem.B.dylib
in /PATH_TO_APP/APP.app/Contents/Resources/lib/python2.7/lib-dynload/PIL/_imaging.so
Earlier, to get around this error, I just uninstalled pillow. I'm not sure why pillow libraries were being added to the app to begin with, since I didn't think I was using it. But now, when attempting this workaround, I get another error:
Traceback (most recent call last):
File "/PATH_TO_APP.app/APP.app/Contents/Resources/__boot__.py", line 384, in <module> _recipes_pil_prescript([])
File "/PATH_TO_APP.app/APP.app/Contents/Resources/__boot__.py", line 344, in _recipes_pil_prescript from PIL import Image
File "/usr/local/lib/python2.7/site-packages/PIL/Image.py", line 62, in <module>
ImportError cannot import name _imaging
Apparently I'm using PIL now somehow. My script imports the following:
from __future__ import division
import easygui as eg
import os, zlib, re, datetime, getpass, tkMessageBox, sys
import zipfile as z
import Tkinter as tk
from tkFileDialog import askdirectory
from optparse import OptionParser
Here's my setup.py:
from setuptools import setup
APP = ['zipperscript.py']
DATA_FILES = []
OPTIONS = {'argv_emulation': True, 'excludes': ['']}
setup(
app=APP,
name="Zipperscript_HI_50",
data_files=DATA_FILES,
options={'py2app': OPTIONS},
setup_requires=['py2app'],
version="Hawaii branch 4.0.50"
)
I'm not sure that the OS version is causing the problem, but that's my theory right now. I'm not sure how to proceed. Any help or suggestions are greatly appreciated.
I encountered a similar problem while using buildout on Mac OS 10.8.5. It seems that the pre-compiled packages available on Pypi have been compiled on newer versions of OS X and unfortunately insufficiently tested on older versions.
The solution is to install pillow from source instead. Download the source, and run pip install your_downloaded_file. You may need to install dependencies such as libjpeg and zlib beforehand.
After doing this I do not encounter the errors anymore and have pillow version 5.4.0 installed.
I'm trying to install an iPhone app to an iPhone using Appcelerator Titanium 1.2.2 with SDK 1.6.2
The app ID matches the profile, runs fine on the simulator, but fails to install to the device with this error:
Install Error:
[DEBUG] While reading /htdocs/titanium/EA/build/iphone/build/Release-iphoneos/EA.app/Default#2x.png pngcrush caught libpng error:
[ERROR] [ERROR] While reading /htdocs/titanium/EA/build/iphone/build/Release-iphoneos/EA.app/Default#2x.png pngcrush caught libpng error:
[ERROR]
[ERROR] Error: Traceback (most recent call last):
File "/Library/Application Support/Titanium/mobilesdk/osx/1.6.2/iphone/builder.py", line 1238, in main
execute_xcode("iphoneos%s" % iphone_version,args,False)
File "/Library/Application Support/Titanium/mobilesdk/osx/1.6.2/iphone/builder.py", line 1012, in execute_xcode
output = run.run(args,False,False,o)
File "/Library/Application Support/Titanium/mobilesdk/osx/1.6.2/iphone/run.py", line 39, in run
sys.exit(rc)
SystemExit: 1
Any clues?
Thanks,
N.
Did you verify the file reading /htdocs/titanium/EA/build/iphone/build/Release-iphoneos/EA.app/Default#2x.png exists?
Also verify it is a PNG file by getting info on the file and make sure it has the extension .png and not something else hidden. You can also open it and save as a png file to hopefully fix the issue?
I installed the iphone-python package from Cydia, but the HelloPython app closes immediately when I run it from Springboard.
This may be a red herring, but I found the .py file in Terminal and tried to run it with python and got a python error:
$ python /private/var/stash/Applications.pwn/HelloPython.app/HelloPython.py
Traceback (most recent call last):
File "/private/var/stash/Applications.pwn/HelloPython.app/HelloPython.py", line 9, in <module>
import objc
File "/usr/lib/python2.5/objc/__init__.py", line 17, in <module>
_update()
File "/usr/lib/python2.5/objc/__init__.py", line 14, in _update
import _objc
ImportError: dlopen(/usr/lib/python2.5/lib-dynload/_objc.dylib, 2): Symbol not found: _OBJC_CLASS_$_Object
Referenced from: /usr/lib/python2.5/lib-dynload/_objc.dylib
Expected in: /usr/lib/libobjc.A.dylib
I'm running 4.3.3.
How can I get this app working, so I'll have a working example of PyObjC?
Well due to the changes in the way executables on the new ios run, the dynamic library has become corrupt. The mach-o will no longer run due to the upgraded objective-c so a workaround would be to compile pyobjc from source and run normaly. The only ptoblem with that is that the iphone's version of pyobjc is built for uikit so you would need to find saurik's (Jay Freeman) source code and compile it. I might do that for myself so ill post back with a deb file if i do.