I created an application and bundled it to exe by pyinstaller, however after I tested the exe application, it responded an error message. It seems like my essential api module wasn't imported properly. Please advise, thanks!
ImportError! Could not load api or model class Sheets
Exception in Tkinter callback
Traceback (most recent call last):
File "tkinter\__init__.py", line 1883, in __call__
File "D:\Python Projects\Concept Number Generator\Concept Number Generator.py", line 12, in concept_num
my_sheet=smartsheet_client.Sheets.get_sheet(8743006875477892)
AttributeError: 'str' object has no attribute 'get_sheet'
Based on a search here in Stack Overflow, looks like others have run into this issue in the past. Try importing smartsheet.Sheets -- as described under the heading EDIT 2 in this question: including smartsheet sdk in a bundled app via pyinstaller.
Related
When running a python3 script that generates a word document on a windows machine the following error occurs:
08:53:23 Traceback (most recent call last):
08:53:23 File "c:\python\venv\py3-32-report-generator\lib\site-packages\win32com\client\gencache.py", line 236, in GetModuleForCLSID
08:53:23 __import__(sub_mod_name)
08:53:23 ModuleNotFoundError: No module named 'win32com.gen_py.00020905-0000-0000-C000-000000000046x0x8x4.ListTemplates'
The error only occurs once in a while, thats what confuses me so much.
It reminded me of a similar AttributeError that could be resolved by deleting the gen_py folder in ../AppData/Local/Temp/. Unfortunately this fix doesnt seem to help here.
If you need any more info describing the problem let me know. Thanks:)
I'm currently trying to install seafile 7.1.4 on a Raspberry Pi 4 following the official guide (https://download.seafile.com/published/seafile-manual/deploy/using_mysql.md). The setup went smoothly, but when I try to start the seahub (./seahub start) for the first time I get the following error:
Traceback (most recent call last):
File "check_init_admin.py", line 351, in <module>
rpc = RPC()
File "check_init_admin.py", line 284, in __init__
import ccnet
ModuleNotFoundError: No module named 'ccnet'
I've been on google for the past two hours, but can't find a solution to this problem. What am I doing wrong?
I ran into the same issue. There's a bug in the 7.1.4 package. Seafile uses some local site packages. They (apparently) used to be under ${INSTALLPATH}/seafile/lib/python3.6/site-packages, now the are under ${INSTALLPATH}/seafile/lib/python3.7/site-packages
To fix:
open seahub.sh in the editor of your choice.
find the line that says:
export PYTHONPATH=${INSTALLPATH}/seafile/lib/python3.6/site-packages:${INSTALLPATH}/seafile/lib64/python3.6/site-packages:${INSTALLPATH}/seahub:${INSTALLPATH}/seahub/thirdpart:$PYTHONPATH
change it to read:
export PYTHONPATH=${INSTALLPATH}/seafile/lib/python3.7/site-packages:${INSTALLPATH}/seafile/lib64/python3.7/site-packages:${INSTALLPATH}/seahub:${INSTALLPATH}/seahub/thirdpart:$PYTHONPATH
I am using ITKPython,
My codes are working well in PyCharm with *.py format but after making a standalone *.exe file via PyInstaller some errors occure as follow:
Traceback (most recent call last):
File “RSG_V_0.py”, line 27, in <module>
File “site-packages\itkExtras.py”, line 449, in imread
File “site-packages\itkLazy.py”, line 40, in getattribute
AttributeError: ‘LazyITKModule’ object has no attribute ‘ImageFileReader’
[29316] Failed to execute script RSG_V_0
Would you please show me the way to solve these kind of problems.
By the way, already I test my PyInstaller with a simple print.py, In fact PyInstaller is working correctly without ITK filters.
Thanks
Sina
That is most likely a problem in PyInstaller. Report it on their issue tracker.
I'm new to pyinstaller and trying to package a script I wrote that connects to Smartsheet. The code runs fine in PyCharm, but when I go to run the executable that it outputs the client object is just treated as a string and won't let me access any attributes.
ImportError! Could not load api or model class Users
Traceback (most recent call last):
File "filename.py", line XX, in <module>
AttributeError: 'str' object has no attribute 'get_current_user'
[1480] Failed to execute script filename
PyInstaller: 3.4
Python: 3.6.5
Windows: 7
Update:
It looks like smartsheet is trying to import the requests.packages.urllib3 library but this is failing. I've tride adding the directory to this file using:
pyi-makespec --paths=directory\requests\packages.py myapp.py
pyi-makespec --paths=directory\smartsheet\smartsheet.py myapp.py
but it's still failing.
We're working on a Cocos2D game for Ludum Dare right now, and we are having issues packaging the game into an executable of some kind.
We have tried using py2exe, but it doesn't seem to work. I've read that py2exe often causes problems with this kind of libraries, but that they are usually workable. However, I've been doing some research for the last few hours and I can't seem to find a solution.
Here's the error message it gives us when executing the .exe, apparently it can't import the pyglet.resource module.
C:\Users\Jon\Documents\GitHubVisualStudio\King-of-the-Dungeon\King of the Dungeon\King of the Dungeon\dist>king_of_the_dungeon.exe
Traceback (most recent call last):
File "C:\Python34\lib\site-packages\pyglet\__init__.py", line 351, in __getattr__
return getattr(self._module, name)
AttributeError: 'NoneType' object has no attribute 'path'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "king_of_the_dungeon.py", line 1, in <module>
File "C:\Python34\lib\site-packages\cocos2d-0.6.3-py3.4.egg\cocos\__init__.py", line 71, in <module>
pyglet.resource.path.append(
File "C:\Python34\lib\site-packages\pyglet\__init__.py", line 357, in __getattr__
__import__(import_name)
ImportError: No module named 'pyglet.resource'
I just tried it myself and It works without problem. But I used cx_freeze.
See, Py2exe is old, no longer maintained, and overall you're better off using cx_freeze.
Download cx_freeze
create a setup.py file to create an exe:
import cx_Freeze
# Change "App" to the name of your python script
executables = [cx_Freeze.Executable("App.py")]
cx_Freeze.setup(
name="Sample Name",
version = "1",
options={"build_exe": {"packages":["pyglet", "cocos", "pygame"]}},
executables = executables
)
open cmd / terminal and build with ; python setup.py build
I just tried it with a simple game and it compiled with no trouble.