I am a complete code novice. I am trying to teach myself python and so far I've been able to do rudimentary scripting. I want to try and learn how to use an OCR which might be somewhat advanced for me, but I'm doing it for fun so I have all the time in the world.
I'm trying to set up pytesser and I understand I need to download both the pytesser module and a PIL. I think there is a problem with how I'm storing my files.
Right now my PIL directory is located in:
C:\Python27\Lib\site-packages
and my pytesser_v0.01 directory is located in:C:\Python27\Lib\site-packages
I try to do the basic test found here
And I keep getting the following error
>>> from pytesser import*
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named pytesser
I think this is a very simple question because I keep looking to where to install my PIL and pytesser directories and every online forum/help starts by saying "install it" and not where.
Edit:
I found the correct place to install pytesser but now i'm getting the following errors. The first problem was solved by making sure that pytesser, util, errors and tesseract.exe were in the site-package file and the program didn't have to go into the pytesser folder.
>>> image = Image.open('fnord.tif')
>>> print image_to_string(image)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\pytesser.py", line 30, in image_to_string
util.image_to_scratch(im, scratch_image_name)
File "C:\Python27\lib\site-packages\util.py", line 7, in image_to_scratch
im.save(scratch_image_name, dpi=(200,200))
File "C:\Python27\lib\site-packages\PIL\Image.py", line 1433, in save
fp = __builtin__.open(fp, "wb")
IOError: [Errno 13] Permission denied: 'temp.bmp'
Related
My program is supposed to open a docx file 'Core.docx' with python-docx and does it just fine until I make an executable out of it with pyinstaller. I got the same error doing this on Windows 10 but was able to fix it by manually copying 'Core.docx' into the dist folder. On Mac, it doesn't solve it.
Error:
Traceback (most recent call last):
File "script.py", line 13, in <module>
File "docx/api.py", line 25, in Document
File "docx/opc/package.py", line 128, in open
File "docx/opc/pkgreader.py", line 32, in from_file
File "docx/opc/phys_pkg.py", line 30, in __new__
docx.opc.exceptions.PackageNotFoundError: Package not found at 'Core.docx'
[7946] Failed to execute script 'script' due to unhandled exception!
I've also tried the function --add-data after reading this exchange:
pyinstaller -F --add-data "Core.docx:Core.docx" script.py
It ran but nothing seems to have actually changed.
Does anyone know of any solutions?
I'm on Windows and I work with python 3.8.
If I execute a python script where libraries need to be compiled, I will get the following error:
Failed to import ahead-of-time-compiled modules.
This is expected on first import.
Compiling modules and trying again.
This might take a minute.
Traceback (most recent call last):
File "C:\Users\...\env\lib\site-packages\pymatting_aot\cc.py", line 36, in <module>
import pymatting_aot.aot
ModuleNotFoundError: No module named 'pymatting_aot.aot
I already installed pymatting with pip.
Does anybody now a solution to solve this error?
I'm developing a GUI app in Python. I use cx_Freeze to turn my app into .app/ / .dmg files for OS X users. So, for instance I can use python setup.py bdist_dmg to make cx_Freeze create a .dmg file that my users can use to install my app.
I now want my app to update itself automatically. Esky seems to be a promising framework for doing this. I can do python setup.py bdist_esky to create a version of my app that updates itself. It produces the following directory structure:
myapp
myapp-0.1/
myapp
...
...
The top-level myapp is Esky's bootstrapping executable. It looks in the current directory, finds myapp-0.1/ as the latest version and then launches myapp-0.1/myapp.
How do I package this into a .dmg file which I can ship to my users? After my modifications to setup.py to get bdist_esky to work, bdist_dmg no longer works. The impression I get is that Esky is simply not meant to be used with bdist_dmg. Its documentation doesn't mention DMG files at all and I also couldn't find anything on Google.
As a first step, I tried to manually turn the files generated by Esky into an OS X .app/ bundle:
myapp.app/
Contents/
Info.plist
MacOS/
myapp
myapp-0.1/
myapp
...
...
Info.plist contains the minimum amount of necessary information to get OS X to run myapp. When I try to run myapp.app however, I get:
Traceback (most recent call last):
File "<string>", line 318, in bootstrap
File "<string>", line 442, in get_best_version
FileNotFoundError: [Errno 2] No such file or directory: '/Users/michael/Temp/myapp.app/appdata'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 689, in <module>
File "<string>", line 335, in bootstrap
RuntimeError: no usable frozen versions were found
Looking at Esky's source code, it appears to have some special handling for OS X bundles in its appdir_from_executable(...) function. To make Esky happy, I tried to rearrange my files so appdata/ actually exists:
myapp.app/
appdata/
myapp-0.1/
myapp
...
Contents/
Info.plist
MacOS/
myapp
...
Unfortunately, this results in another error:
Traceback (most recent call last):
File "<string>", line 689, in <module>
File "<string>", line 336, in bootstrap
File "<string>", line 363, in chainload
File "<string>", line 425, in _chainload
UnboundLocalError: local variable 'exc_value' referenced before assignment
Is this really that difficult? Am I the only one who wants to use Esky and ship files to users in the (standard) .dmg format? What am I missing?
Michael, I saw your comment in the github issue as well. Let me answer it here.
I had the same requirement and resolved in a similar way but I think I didn't use cx_Freeze. Another difference could be that I used Python 2.7.x. The best way to help you is to show you a few relevant files which worked well for me for creating .app and .dmg.
1) The main setup file of the python project:
https://dl.dropboxusercontent.com/u/13110611/temp/package_esky/setup_esky.py
2) The utility script I used to prepare some data files etc
https://dl.dropboxusercontent.com/u/13110611/temp/package_esky/prepare_setup.py
3) The main shell script I used to create app and DMG. That is, this script will call everything else, and it's the only script I used from command line directly.
https://dl.dropboxusercontent.com/u/13110611/temp/package_esky/package.sh
4) The dmg-setup script which will create DMS from .app file. It's just a simple wrapper script to call create-dmg, an open souce project.
https://dl.dropboxusercontent.com/u/13110611/temp/package_esky/dmg-setup
Please try and let me know in case you have any other questions or issues.
I am a newbie to Python, and I have an issue that I believe is due to circular dependencies, but I have been unable to resolve it.
How can I figure out where the circular dependency is occurring, and what can I do to resolve this error (please find the terminal output below): (I use OsX Yosemite, if that helps)
python l3_l0.py
Traceback (most recent call last):
File "l3_l0.py", line 18, in <module>
import geopandas as gpd
File "build/bdist.macosx-10.10-intel/egg/geopandas/__init__.py", line 6, in <module>
File "build/bdist.macosx-10.10-intel/egg/geopandas/geoseries.py", line 12, in <module>
Thank you!
Uninstall conflicting dependencies in the order of installation, and reinstall them in the correct order. This seems to the simplest solution, and it worked for m!
I've seen other people say they have this error from openstack also, but I have not been able to find any kind of answer.
I followed the website http://uksysadmin.wordpress.com/2011/02/17/ for the base installation of openstack, and this seems to work correctly.
Now I'm following the website http://wiki.openstack.org/OpenStackDashboard to install openstack Dashboard and when I get to the command "tools/with_venv.sh dashboard/manage.py syncdb" I get this error:
ERROR:root:No module named local.local_settings
Traceback (most recent call last):
File "/home/harlan/horizon/openstack-dashboard/dashboard/settings.py", line 126, in <module>
from local.local_settings import *
ImportError: No module named local.local_settings
ERROR:root:No module named local.local_settings
Traceback (most recent call last):
File "/home/harlan/horizon/openstack-dashboard/dashboard/../dashboard/settings.py", line 126, in <module>
from local.local_settings import *
ImportError: No module named local.local_settings
Error: No module named horizon.dashboards.settings
I'm doing the installation on Ubuntu 11.10 Server.
It looks like it's not finding your local_settings.py file, make sure you did this step (documented on the wiki):
$ cd horizon/openstack-dashboard
$ cp local/local_settings.py.example local/local_settings.py
As an aside, the simplest way to get up and running with OpenStack is to use DevStack.