![](/img/trans.png)
[英]I get an EOFError because of an input() I have in my Python program. I don't even know why I have it. How should I fix it?
[英]I can't package my program with Pyinstaller because I have enum34 installed, can't uninstall because a used module needs it. Any suggestions?
所以我試圖打包我為我的工作編寫的程序,允許人們同時在多個spreadhseets(@ Smartsheets)上添加,更新,刪除相同的行/列。 我正在使用Kivy和Smartsheet-Python-SDK
當我按照Kivy的指示使用PyInstaller打包應用程序時,我得到錯誤:“module'enum34'沒有屬性'IntFlag'”和“'str'對象沒有屬性'items'”
現在,當我搜索此錯誤時,我看到的唯一建議是卸載enum34並安裝常規枚舉模塊。
更大的問題是Smartsheet API需要enum34,而PyInstaller需要常規枚舉。
有關如何解決這個問題的任何建議? 我可以吃蛋糕也可以吃它,兩個都安裝好了嗎? 似乎enum34安裝在與枚舉相同的文件夾中(我可能錯了,但我以為我不止一次讀過這個)。
我看過這個網站上的建議,但我需要以某種方式同時滿足每個要求。
我試過卸載enum34並安裝常規枚舉,但你可以猜到它會破壞我的智能表模塊。
這是錯誤,不確定我的代碼是否必要(加上我努力工作,不希望它被盜)。
53 INFO: PyInstaller: 3.4
53 INFO: Python: 3.7.2
54 INFO: Platform: Windows-10-10.0.17763-SP0
55 INFO: wrote C:\Users\mpalu\Desktop\Smartsheet Mass Editor\SSMassEditor.spec
57 INFO: UPX is not available.
58 INFO: Extending PYTHONPATH with paths
['C:\\Users\\mpalu\\Desktop\\Smartsheet Mass Editor',
'C:\\Users\\mpalu\\Desktop\\Smartsheet Mass Editor']
58 INFO: checking Analysis
58 INFO: Building Analysis because Analysis-00.toc is non existent
59 INFO: Initializing module dependency graph...
61 INFO: Initializing module graph hooks...
63 INFO: Analyzing base_library.zip ...
Traceback (most recent call last):
File "<string>", line 41, in <module>
File "<string>", line 13, in walk_packages
File "C:\Users\mpalu\AppData\Local\Programs\Python\Python37-32\lib\pkgutil.py", line 130, in iter_modules
for name, ispkg in iter_importer_modules(i, prefix):
File "C:\Users\mpalu\AppData\Local\Programs\Python\Python37-32\lib\pkgutil.py", line 149, in _iter_file_finder_modules
import inspect
File "C:\Users\mpalu\AppData\Local\Programs\Python\Python37-32\lib\inspect.py", line 40, in <module>
import linecache
File "C:\Users\mpalu\AppData\Local\Programs\Python\Python37-32\lib\linecache.py", line 11, in <module>
import tokenize
File "C:\Users\mpalu\AppData\Local\Programs\Python\Python37-32\lib\tokenize.py", line 33, in <module>
import re
File "C:\Users\mpalu\AppData\Local\Programs\Python\Python37-32\lib\re.py", line 143, in <module>
class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'....
....
3090 INFO: Caching module hooks...
3096 INFO: Analyzing C:\Users\mpalu\Desktop\Smartsheet Mass Editor\SS_Mass_Editor.py
3676 INFO: Processing pre-safe import module hook urllib3.packages.six.moves
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "C:\Users\mpalu\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\__init__.py", line 8, in <module>
from .connectionpool import (
File "C:\Users\mpalu\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connectionpool.py", line 3, in <module>
import logging ....
AttributeError: 'str' object has no attribute 'items' </code>
如上所述,我只想打包這個程序,這樣辦公室里的人就可以使用它而不必安裝python和所有軟件包(這里沒有人是計算機),並使用批處理文件來運行程序。
enum34
是enum34
中引入的enum
類型的后端庫,請參閱PEP435 ,也許這是SO帖子 。 但是由於您運行的是python3.7,因此這種依賴關系不正確。
顯然, smartsheet
開發人員已經知道這個問題並提供了修復。 請參閱此問題說明和修復提交 。 升級smartsheet
可能會解決您的問題。
pip install smartsheet-python-sdk --upgrade
如果最新版本尚未通過pip
,您可以從源代碼安裝它:
# Clone the repository
git clone https://github.com/smartsheet-platform/smartsheet-python-sdk.git
# As of now (Jan 2019), the fix has not been merged to master yet.
# Hence, directly clone the patch branch:
# git clone -b tw-updates-2.0 https://github.com/smartsheet-platform/smartsheet-python-sdk.git
cd smartsheet-python-sdk
# Install the module.
python setup.py install
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.