How to fix "OSError: cannot open profile file" using Pyinstaller - python

I am working on a small script, which is going to open external .PSD and do some logging from it.
I am using psd_tools to work with PSD. It uses PIL.
Everything works fine until I bundle it into .EXE with pyinstaller.
Then it throws OSError: cannot open profile file.
I cant figure out whether the problem is in PIL, psd_tools or pyinstaller(Well, I am pretty newbie though).
Here is the code:
from psd_tools import *
psd = PSDImage.load('C:\python3\layers.psd')
print('success')
Here is the traceback:
Traceback (most recent call last):
File "layers_tr.py", line 1, in <module>
from psd_tools 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 "C:\Users\Alexander\AppData\Local\Programs\Python\Python37-32\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
exec(bytecode, module.__dict__)
File "site-packages\psd_tools\__init__.py", line 2, 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:\Users\Alexander\AppData\Local\Programs\Python\Python37-32\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
exec(bytecode, module.__dict__)
File "site-packages\psd_tools\user_api\psd_image.py", line 10, 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:\Users\Alexander\AppData\Local\Programs\Python\Python37-32\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
exec(bytecode, module.__dict__)
File "site-packages\psd_tools\user_api\pil_support.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 "C:\Users\Alexander\AppData\Local\Programs\Python\Python37-32\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
exec(bytecode, module.__dict__)
File "site-packages\psd_tools\icc_profiles\__init__.py", line 10, in <module>
File "site-packages\PIL\ImageCms.py", line 162, in __init__
OSError: cannot open profile file
[12424] Failed to execute script layers_tr
Any help pls

Updaing psd_tools with
pip install -U psd_tools
solved the problem. Big Thanks to M. R.

Related

python KeyError in File "<frozen importlib._boostrap>" ... bad file descriptor? [duplicate]

whenever i try to install pip i always get this error. pls help . i dont know how to fix this i tried doing it using the default python executable using the modify method and also tried the get-pip.py file method nothing works. i have checked my path variables too so the scripts folder is there but pip is not installed.
PS C:\Users\ismai\Desktop\programs\PYTHON> python get-pip.py
Traceback (most recent call last):
File "C:\Users\ismai\Desktop\programs\PYTHON\get-pip.py", line 23704, in <module>
main()
File "C:\Users\ismai\Desktop\programs\PYTHON\get-pip.py", line 198, in main
bootstrap(tmpdir=tmpdir)
File "C:\Users\ismai\Desktop\programs\PYTHON\get-pip.py", line 83, in bootstrap
from pip._internal.commands.install import InstallCommand
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "C:\Users\ismai\AppData\Local\Temp\tmpz82tcza4\pip.zip\pip\_internal\commands\install.py", line 17, in <module>
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "C:\Users\ismai\AppData\Local\Temp\tmpz82tcza4\pip.zip\pip\_internal\cli\req_command.py", line 16, in <module>
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "C:\Users\ismai\AppData\Local\Temp\tmpz82tcza4\pip.zip\pip\_internal\index\collector.py", line 14, in <module>
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "C:\Users\ismai\AppData\Local\Temp\tmpz82tcza4\pip.zip\pip\_vendor\requests\__init__.py", line 125, in <module>
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "C:\Users\ismai\AppData\Local\Temp\tmpz82tcza4\pip.zip\pip\_vendor\requests\utils.py", line 27, in <module>
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "C:\Users\ismai\AppData\Local\Temp\tmpz82tcza4\pip.zip\pip\_vendor\requests\_internal_utils.py", line 11, in <module>
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "C:\Users\ismai\AppData\Local\Temp\tmpz82tcza4\pip.zip\pip\_vendor\requests\compat.py", line 65, in <module>
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 786, in exec_module
File "<frozen importlib._bootstrap_external>", line 922, in get_code
File "<frozen importlib._bootstrap_external>", line 980, in get_data
OSError: [Errno 9] Bad file descriptor
I actually had a similar problem and tried every possible solution, the only one which worked with me is to uninstall python and reinstall it in different partition other than the C , it will work !
Go to the folder in which you Python installer is there and click on it. It will open the installer and show "modify setup":
Uninstall python and then download it from https://www.python.org/downloads/ reinstall it and make sure to check the box that adds pip to PATH.
Ok guys i tried unistalling this new version(3.9) and then installed an old version(3.7) and then ran the command python get-pip.py and magically it worked. if anyone in future wants to fix this issue then try this. i also read the python documenttion and apparantly they have a command if pip isnt installed on your version of python that is python -m ensurepip so you can try that too.
And then click on "Uninstall". After uninstall done click on close and again go to your installer and click on it and after that it will show like this.
After check Add python to PATH and click on "customize installation". Check everything in advanced option and click install.
Done!

Getting error Bad File Descriptor while installing pip

whenever i try to install pip i always get this error. pls help . i dont know how to fix this i tried doing it using the default python executable using the modify method and also tried the get-pip.py file method nothing works. i have checked my path variables too so the scripts folder is there but pip is not installed.
PS C:\Users\ismai\Desktop\programs\PYTHON> python get-pip.py
Traceback (most recent call last):
File "C:\Users\ismai\Desktop\programs\PYTHON\get-pip.py", line 23704, in <module>
main()
File "C:\Users\ismai\Desktop\programs\PYTHON\get-pip.py", line 198, in main
bootstrap(tmpdir=tmpdir)
File "C:\Users\ismai\Desktop\programs\PYTHON\get-pip.py", line 83, in bootstrap
from pip._internal.commands.install import InstallCommand
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "C:\Users\ismai\AppData\Local\Temp\tmpz82tcza4\pip.zip\pip\_internal\commands\install.py", line 17, in <module>
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "C:\Users\ismai\AppData\Local\Temp\tmpz82tcza4\pip.zip\pip\_internal\cli\req_command.py", line 16, in <module>
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "C:\Users\ismai\AppData\Local\Temp\tmpz82tcza4\pip.zip\pip\_internal\index\collector.py", line 14, in <module>
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "C:\Users\ismai\AppData\Local\Temp\tmpz82tcza4\pip.zip\pip\_vendor\requests\__init__.py", line 125, in <module>
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "C:\Users\ismai\AppData\Local\Temp\tmpz82tcza4\pip.zip\pip\_vendor\requests\utils.py", line 27, in <module>
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "C:\Users\ismai\AppData\Local\Temp\tmpz82tcza4\pip.zip\pip\_vendor\requests\_internal_utils.py", line 11, in <module>
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "C:\Users\ismai\AppData\Local\Temp\tmpz82tcza4\pip.zip\pip\_vendor\requests\compat.py", line 65, in <module>
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 786, in exec_module
File "<frozen importlib._bootstrap_external>", line 922, in get_code
File "<frozen importlib._bootstrap_external>", line 980, in get_data
OSError: [Errno 9] Bad file descriptor
I actually had a similar problem and tried every possible solution, the only one which worked with me is to uninstall python and reinstall it in different partition other than the C , it will work !
Go to the folder in which you Python installer is there and click on it. It will open the installer and show "modify setup":
Uninstall python and then download it from https://www.python.org/downloads/ reinstall it and make sure to check the box that adds pip to PATH.
Ok guys i tried unistalling this new version(3.9) and then installed an old version(3.7) and then ran the command python get-pip.py and magically it worked. if anyone in future wants to fix this issue then try this. i also read the python documenttion and apparantly they have a command if pip isnt installed on your version of python that is python -m ensurepip so you can try that too.
And then click on "Uninstall". After uninstall done click on close and again go to your installer and click on it and after that it will show like this.
After check Add python to PATH and click on "customize installation". Check everything in advanced option and click install.
Done!

Anaconda wouldn't start. OSError: [Errno 9] Bad file descriptor [duplicate]

whenever i try to install pip i always get this error. pls help . i dont know how to fix this i tried doing it using the default python executable using the modify method and also tried the get-pip.py file method nothing works. i have checked my path variables too so the scripts folder is there but pip is not installed.
PS C:\Users\ismai\Desktop\programs\PYTHON> python get-pip.py
Traceback (most recent call last):
File "C:\Users\ismai\Desktop\programs\PYTHON\get-pip.py", line 23704, in <module>
main()
File "C:\Users\ismai\Desktop\programs\PYTHON\get-pip.py", line 198, in main
bootstrap(tmpdir=tmpdir)
File "C:\Users\ismai\Desktop\programs\PYTHON\get-pip.py", line 83, in bootstrap
from pip._internal.commands.install import InstallCommand
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "C:\Users\ismai\AppData\Local\Temp\tmpz82tcza4\pip.zip\pip\_internal\commands\install.py", line 17, in <module>
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "C:\Users\ismai\AppData\Local\Temp\tmpz82tcza4\pip.zip\pip\_internal\cli\req_command.py", line 16, in <module>
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "C:\Users\ismai\AppData\Local\Temp\tmpz82tcza4\pip.zip\pip\_internal\index\collector.py", line 14, in <module>
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "C:\Users\ismai\AppData\Local\Temp\tmpz82tcza4\pip.zip\pip\_vendor\requests\__init__.py", line 125, in <module>
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "C:\Users\ismai\AppData\Local\Temp\tmpz82tcza4\pip.zip\pip\_vendor\requests\utils.py", line 27, in <module>
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "C:\Users\ismai\AppData\Local\Temp\tmpz82tcza4\pip.zip\pip\_vendor\requests\_internal_utils.py", line 11, in <module>
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "C:\Users\ismai\AppData\Local\Temp\tmpz82tcza4\pip.zip\pip\_vendor\requests\compat.py", line 65, in <module>
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 786, in exec_module
File "<frozen importlib._bootstrap_external>", line 922, in get_code
File "<frozen importlib._bootstrap_external>", line 980, in get_data
OSError: [Errno 9] Bad file descriptor
I actually had a similar problem and tried every possible solution, the only one which worked with me is to uninstall python and reinstall it in different partition other than the C , it will work !
Go to the folder in which you Python installer is there and click on it. It will open the installer and show "modify setup":
Uninstall python and then download it from https://www.python.org/downloads/ reinstall it and make sure to check the box that adds pip to PATH.
Ok guys i tried unistalling this new version(3.9) and then installed an old version(3.7) and then ran the command python get-pip.py and magically it worked. if anyone in future wants to fix this issue then try this. i also read the python documenttion and apparantly they have a command if pip isnt installed on your version of python that is python -m ensurepip so you can try that too.
And then click on "Uninstall". After uninstall done click on close and again go to your installer and click on it and after that it will show like this.
After check Add python to PATH and click on "customize installation". Check everything in advanced option and click install.
Done!

OSError: [Errno 9] Bad file descriptor after ransonware attack [duplicate]

whenever i try to install pip i always get this error. pls help . i dont know how to fix this i tried doing it using the default python executable using the modify method and also tried the get-pip.py file method nothing works. i have checked my path variables too so the scripts folder is there but pip is not installed.
PS C:\Users\ismai\Desktop\programs\PYTHON> python get-pip.py
Traceback (most recent call last):
File "C:\Users\ismai\Desktop\programs\PYTHON\get-pip.py", line 23704, in <module>
main()
File "C:\Users\ismai\Desktop\programs\PYTHON\get-pip.py", line 198, in main
bootstrap(tmpdir=tmpdir)
File "C:\Users\ismai\Desktop\programs\PYTHON\get-pip.py", line 83, in bootstrap
from pip._internal.commands.install import InstallCommand
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "C:\Users\ismai\AppData\Local\Temp\tmpz82tcza4\pip.zip\pip\_internal\commands\install.py", line 17, in <module>
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "C:\Users\ismai\AppData\Local\Temp\tmpz82tcza4\pip.zip\pip\_internal\cli\req_command.py", line 16, in <module>
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "C:\Users\ismai\AppData\Local\Temp\tmpz82tcza4\pip.zip\pip\_internal\index\collector.py", line 14, in <module>
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "C:\Users\ismai\AppData\Local\Temp\tmpz82tcza4\pip.zip\pip\_vendor\requests\__init__.py", line 125, in <module>
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "C:\Users\ismai\AppData\Local\Temp\tmpz82tcza4\pip.zip\pip\_vendor\requests\utils.py", line 27, in <module>
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "C:\Users\ismai\AppData\Local\Temp\tmpz82tcza4\pip.zip\pip\_vendor\requests\_internal_utils.py", line 11, in <module>
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "C:\Users\ismai\AppData\Local\Temp\tmpz82tcza4\pip.zip\pip\_vendor\requests\compat.py", line 65, in <module>
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 786, in exec_module
File "<frozen importlib._bootstrap_external>", line 922, in get_code
File "<frozen importlib._bootstrap_external>", line 980, in get_data
OSError: [Errno 9] Bad file descriptor
I actually had a similar problem and tried every possible solution, the only one which worked with me is to uninstall python and reinstall it in different partition other than the C , it will work !
Go to the folder in which you Python installer is there and click on it. It will open the installer and show "modify setup":
Uninstall python and then download it from https://www.python.org/downloads/ reinstall it and make sure to check the box that adds pip to PATH.
Ok guys i tried unistalling this new version(3.9) and then installed an old version(3.7) and then ran the command python get-pip.py and magically it worked. if anyone in future wants to fix this issue then try this. i also read the python documenttion and apparantly they have a command if pip isnt installed on your version of python that is python -m ensurepip so you can try that too.
And then click on "Uninstall". After uninstall done click on close and again go to your installer and click on it and after that it will show like this.
After check Add python to PATH and click on "customize installation". Check everything in advanced option and click install.
Done!

Xlwings module causes PyInstaller EXE to throw exception

I'm trying to freeze a simple Python 3.4 script called test.py using pyinstaller. The script imports version 0.7.0 of the xlwings module (which I installed via pip), and then print a message.
import xlwings
print("Fine!")
If I remove the xlwings import, then pyinstaller test.py generates an EXE (I'm on Windows 10) inside the dist folder that prints the "Fine" message and then exits. But, if I import the xlwings module, the command generates an EXE that prints this message and then quits (not printing the "Fine" message):
Traceback (most recent call last):
File "<string>", 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\PyInstaller\loader\pyimod03_importers.py", line 389, in load_module
exec(bytecode, module.__dict__)
File "site-packages\xlwings\__init__.py", line 20, 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\PyInstaller\loader\pyimod03_importers.py", line 389, in load_module
exec(bytecode, module.__dict__)
File "site-packages\xlwings\_xlwindows.py", line 29, 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\PyInstaller\loader\pyimod03_importers.py", line 389, in load_module
exec(bytecode, module.__dict__)
File "site-packages\pandas\__init__.py", line 7, 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\PyInstaller\loader\pyimod03_importers.py", line 573, in load_module
module = loader.load_module(fullname)
File "pandas\tslib.pyx", line 55, in init pandas.tslib (pandas\tslib.c:102924)
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\PyInstaller\loader\pyimod03_importers.py", line 389, in load_module
exec(bytecode, module.__dict__)
File "dateutil\zoneinfo\__init__.py", line 31, in <module>
File "dateutil\zoneinfo\__init__.py", line 24, in getzoneinfofile
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\\Users\\OrangeFlash81\\AppData\\Local\\Temp\\_MEI102122\\dateutil\\zoneinfo'
test returned -1
I'm aware that cx_Freeze has issues when dateutil is imported, and this error message references dateutil. Does pyinstaller suffer the same issues, and if so, how can I resolve them?
It's not exactly a solution, but I decided to switch to using the XLRD module, which does everything I need and works flawlessly with pyinstaller; changing xlwings code to use XLRD isn't too difficult either.

Categories