I downloaded python 3, and it works correctly on a basic script, but when i tried to import a package with pip in cmd, it said it didn't recognise "pip"
I'm on windows 10
I've tried to install different versions of python. I've also tried to install pip by itself at https://pip.pypa.io/en/stable/installing/.
When I try python -m ensurepip or python get-py.py i get this error
Traceback (most recent call last):
File "get-pip.py", line 22312, in <module>
main()
File "get-pip.py", line 197, in main
bootstrap(tmpdir=tmpdir)
File "get-pip.py", line 82, in bootstrap
import pip._internal
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
File "C:\Users\I56600~1\AppData\Local\Temp\tmpgkogcd_v\pip.zip\pip\_internal\__init__.py", line 40, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
File "C:\Users\I56600~1\AppData\Local\Temp\tmpgkogcd_v\pip.zip\pip\_internal\cli\autocompletion.py", line 8, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
File "C:\Users\I56600~1\AppData\Local\Temp\tmpgkogcd_v\pip.zip\pip\_internal\cli\main_parser.py", line 11, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
File "C:\Users\I56600~1\AppData\Local\Temp\tmpgkogcd_v\pip.zip\pip\_internal\commands\__init__.py", line 6, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
File "C:\Users\I56600~1\AppData\Local\Temp\tmpgkogcd_v\pip.zip\pip\_internal\commands\completion.py", line 6, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
File "C:\Users\I56600~1\AppData\Local\Temp\tmpgkogcd_v\pip.zip\pip\_internal\cli\base_command.py", line 21, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
File "C:\Users\I56600~1\AppData\Local\Temp\tmpgkogcd_v\pip.zip\pip\_internal\download.py", line 14, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
File "C:\Users\I56600~1\AppData\Local\Temp\tmpgkogcd_v\pip.zip\pip\_vendor\requests\__init__.py", line 114, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
File "C:\Users\I56600~1\AppData\Local\Temp\tmpgkogcd_v\pip.zip\pip\_vendor\requests\utils.py", line 26, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
File "C:\Users\I56600~1\AppData\Local\Temp\tmpgkogcd_v\pip.zip\pip\_vendor\requests\_internal_utils.py", line 11, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
File "C:\Users\I56600~1\AppData\Local\Temp\tmpgkogcd_v\pip.zip\pip\_vendor\requests\compat.py", line 64, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 724, in exec_module
File "<frozen importlib._bootstrap_external>", line 859, in get_code
File "<frozen importlib._bootstrap_external>", line 917, in get_data
OSError: [Errno 9] Bad file descriptor
C:\Users\I5 6600k\Downloads>pip
'pip' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\I5 6600k\Downloads>python -m pip
C:\Users\I5 6600k\AppData\Local\Programs\Python\Python37\python.exe: No module named pip
I faced a similar issue. My system went through python installation and uninstallation couple of times. Also I created virtual environment few months back using pip.
Recently when I reinstalled python, Scripts folder was empty.
I searched for all Scripts folder from my root directory (This PC). I found some old Scripts folder containing pip packages. I removed those old Scripts folders, uninstalled python and installed again. Now it works.
I strongly recommend you to try this option. Don't forget to check "add PATH to env variable" option while installing python. Hope this helps.
Did you clicked to 'Path' when installing python? If no, then try to uninstall the python, and when edgy install of the python, click to add 'path'.
Related
I have been trying to build a Windows executable from Python files using PyInstaller (and auto-py-to-exe, but the problem really resides with PyInstaller). Once the executable is built (using --onedir) , I try to launch it and it crashes with this error message:
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module
File "sklearn\feature_selection\__init__.py", line 28, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module
File "sklearn\feature_selection\_mutual_info.py", line 9, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module
File "sklearn\neighbors\__init__.py", line 6, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 1050, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "sklearn\neighbors\_ball_tree.pyx", line 1, in init sklearn.neighbors._ball_tree
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'sklearn.neighbors._partition_nodes'
[17176] Failed to execute script 'Make_Model' due to unhandled exception!
I have tried to add sklearn.neighbors._partition_nodes to the hidden imports list, but I still obtain the same error message. I have looked at the very helpful auto-py-to-exe page and the not-as-helpful PyInstaller page, but nothing specific to my problem can be found.
I know that scikit-learn is notoriously difficult to deal with when it comes to PyInstaller, but can anybody provide some guidance about this problem?
In case someone asks, the code is written in Python 3.7.11 in a Windows 10 environment.
I managed to resolve this by doing what sometimes is the best solution: I deleted all my previous attempts at building the executable and re-started afresh using solely auto-py-to-exe. This time, adding sklearn.neighbors._partition_nodes to the hidden import list worked. I was then able to move on to the next problem (XGBoost), but there are plenty of answers available for that.
I'm trying to compile my code that used tensorflow. I've been working with Tensorflow 1.15 although it is compatible with (1.14 and 1.13). Previously had never had issues with pyinstaller but after creating a new conda environment I stopped being able to compile the same code.
To me, it seems like tensorflow and pyinstaller don't play with each other well. I tried a few version combinations and still no luck. I get this error during import tensorlfow statement after compilation. The program runs fine in python 3.7 or python 3.6.
Traceback (most recent call last):
File "my_dir\mv_app.py", line 39, in <module>
from shot_change_detection import shot_change_detection
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "PyInstaller\loader\pyimod03_importers.py", line 623, in exec_module
File "shot_change_detection\shot_change_detection.py", line 42, in <module>
import tensorflow as tf
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "PyInstaller\loader\pyimod03_importers.py", line 623, in exec_module
File "tensorflow\__init__.py", line 99, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "PyInstaller\loader\pyimod03_importers.py", line 623, in exec_module
File "tensorflow_core\__init__.py", line 28, in <module>
File "<frozen importlib._bootstrap>", line 1019, in _handle_fromlist
File "tensorflow\__init__.py", line 50, in __getattr__
File "tensorflow\__init__.py", line 44, in _load
File "importlib\__init__.py", line 127, in import_module
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "PyInstaller\loader\pyimod03_importers.py", line 623, in exec_module
File "tensorflow_core\python\__init__.py", line 52, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "PyInstaller\loader\pyimod03_importers.py", line 623, in exec_module
File "tensorflow_core\core\framework\graph_pb2.py", line 7, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "PyInstaller\loader\pyimod03_importers.py", line 623, in exec_module
ValueError: source code string cannot contain null bytes
Problem occuring in this line :
from keras import backend as K
I am converting a python source code which uses tensorflow and keras API for testing data.
Using pyinstaller to convert it into exe in Windows OS. I am getting below error related to astor file version. I don't know why i am getting this error after executing the exe file. I am getting no error while running the source code as python filename.py
Using
Python 3.7
tensorflow==1.15
keras==2.0.3
from keras import backend as K is written in exterior file which is imported to main file.
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "c:\program files\python37\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 489, in exec_module
exec(bytecode, module.__dict__)
File "site-packages\keras\__init__.py", line 3, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "c:\program files\python37\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 489, in exec_module
exec(bytecode, module.__dict__)
File "site-packages\keras\activations.py", line 3, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "c:\program files\python37\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 489, in exec_module
exec(bytecode, module.__dict__)
File "site-packages\keras\backend\__init__.py", line 73, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "c:\program files\python37\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 489, in exec_module
exec(bytecode, module.__dict__)
File "site-packages\keras\backend\tensorflow_backend.py", line 1, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "c:\program files\python37\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 489, in exec_module
exec(bytecode, module.__dict__)
File "site-packages\tensorflow\__init__.py", line 28, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "c:\program files\python37\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 489, in exec_module
exec(bytecode, module.__dict__)
File "site-packages\tensorflow\python\__init__.py", line 73, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "c:\program files\python37\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 489, in exec_module
exec(bytecode, module.__dict__)
File "site-packages\tensorflow\python\ops\standard_ops.py", line 25, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "c:\program files\python37\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 489, in exec_module
exec(bytecode, module.__dict__)
File "site-packages\tensorflow\python\autograph\__init__.py", line 37, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "c:\program files\python37\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 489, in exec_module
exec(bytecode, module.__dict__)
File "site-packages\tensorflow\python\autograph\core\converter.py", line 71, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "c:\program files\python37\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 489, in exec_module
exec(bytecode, module.__dict__)
File "site-packages\tensorflow\python\autograph\pyct\cfg.py", line 41, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "c:\program files\python37\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 489, in exec_module
exec(bytecode, module.__dict__)
File "site-packages\tensorflow\python\autograph\pyct\compiler.py", line 32, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "c:\program files\python37\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 489, in exec_module
exec(bytecode, module.__dict__)
File "site-packages\astor\__init__.py", line 24, in <module>
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\{Username}\\AppData\\Local\\Temp\\_MEI98802\\astor\\VERSION'
[8240] Failed to execute script test_exec
You could try to downgrade astor to 0.7.1 and pyinstaller to 3.5
I faced the same problem. My astor package version was 0.8.1. I changed astor version to 0.7.1. It worked for me. pyinstaller version 3.6
I had installed Python 3.7.4, and it doesn't install pip.
Install Python with IDLE and obviously with pip. But when I want to install pip, it shows this error.
Traceback (most recent call last):
File "get-pip.py", line 22312, in <module>
main()
File "get-pip.py", line 197, in main
bootstrap(tmpdir=tmpdir)
File "get-pip.py", line 82, in bootstrap
import pip._internal
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
File "C:\Users\Hp\AppData\Local\Temp\tmp7m70r5qb\pip.zip\pip\_internal\__init__.py", line 40, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
File "C:\Users\Hp\AppData\Local\Temp\tmp7m70r5qb\pip.zip\pip\_internal\cli\autocompletion.py", line 8, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
File "C:\Users\Hp\AppData\Local\Temp\tmp7m70r5qb\pip.zip\pip\_internal\cli\main_parser.py", line 11, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
File "C:\Users\Hp\AppData\Local\Temp\tmp7m70r5qb\pip.zip\pip\_internal\commands\__init__.py", line 6, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
File "C:\Users\Hp\AppData\Local\Temp\tmp7m70r5qb\pip.zip\pip\_internal\commands\completion.py", line 6, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
File "C:\Users\Hp\AppData\Local\Temp\tmp7m70r5qb\pip.zip\pip\_internal\cli\base_command.py", line 21, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
File "C:\Users\Hp\AppData\Local\Temp\tmp7m70r5qb\pip.zip\pip\_internal\download.py", line 14, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
File "C:\Users\Hp\AppData\Local\Temp\tmp7m70r5qb\pip.zip\pip\_vendor\requests\__init__.py", line 114, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
File "C:\Users\Hp\AppData\Local\Temp\tmp7m70r5qb\pip.zip\pip\_vendor\requests\utils.py", line 26, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
File "C:\Users\Hp\AppData\Local\Temp\tmp7m70r5qb\pip.zip\pip\_vendor\requests\_internal_utils.py", line 11, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
File "C:\Users\Hp\AppData\Local\Temp\tmp7m70r5qb\pip.zip\pip\_vendor\requests\compat.py", line 64, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 724, in exec_module
File "<frozen importlib._bootstrap_external>", line 859, in get_code
File "<frozen importlib._bootstrap_external>", line 917, in get_data
OSError: [Errno 9] Bad file descriptor
I am stuck and spent lots of hours. Any help will be appreciated.
Its a simple GUI Script written with tinkter module of python. and Putty tool is called to make some SSH connections. Issue seems to be with compatibilty.
python version : 3.4
pywinauto version : 0.6.2
py2exe version : 0.9.2.2
the created exe file are opening in some windows 7 PCs and throw some error in others. All PCs are Windows 7.
traceback from the cmd;
C:\tools\easy_Login\easy_Login>easy_login.exe
Traceback (most recent call last):
File "easy_login.py", line 1, in <module>
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1191, in _load_unlocked
File "<frozen importlib._bootstrap>", line 1161, in _load_backward_compatible
File "C:\Python34\lib\site-packages\pywinauto\__init__.py", line 40, in <modul
e>
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1191, in _load_unlocked
File "<frozen importlib._bootstrap>", line 1161, in _load_backward_compatible
File "C:\Python34\lib\site-packages\pywinauto\findwindows.py", line 42, in <mo
dule>
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1191, in _load_unlocked
File "<frozen importlib._bootstrap>", line 1161, in _load_backward_compatible
File "C:\Python34\lib\site-packages\pywinauto\controls\__init__.py", line 36,
in <module>
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1191, in _load_unlocked
File "<frozen importlib._bootstrap>", line 1161, in _load_backward_compatible
File "C:\Python34\lib\site-packages\pywinauto\controls\uiawrapper.py", line 44
, in <module>
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1191, in _load_unlocked
File "<frozen importlib._bootstrap>", line 1161, in _load_backward_compatible
File "C:\Python34\lib\site-packages\pywinauto\uia_defines.py", line 175, in <module>
File "C:\Python34\lib\site-packages\pywinauto\uia_defines.py", line 163, in _build_pattern_ids_dic
File "C:\Python34\lib\site-packages\pywinauto\uia_defines.py", line 50, in __call__
File "C:\Python34\lib\site-packages\pywinauto\uia_defines.py", line 63, in __init__
AttributeError: 'module' object has no attribute 'CUIAutomation'
C:\tools\easy_Login\easy_Login>
Try renaming your your source python script "login.py" rather than "easy_login.py" then re-run py2exe to create "login.exe"
It sounds odd, but I had the exact same issue with some W7 machines throwing that error when I was running "ateme_installer.exe" (generated with pyinstaller) and after ruling out all other issues, eventually found that when I renamed it "installer.py" and suddenly the output "installer.exe" worked everywhere!