1

I'm Newbie in python I usually use PyInstaller for convert file .py to .exe and it was work nomally this time i want to convert my .py file like before but it's have error 14037 ERROR: base_library.zip could not be created!

.........................................................

C:\Program Files\Python38>pyinstaller "HPFSERVER_with _mysql .py"
138 INFO: PyInstaller: 3.6
139 INFO: Python: 3.8.2
139 INFO: Platform: Windows-10-10.0.18362-SP0
142 INFO: wrote C:\Program Files\Python38\HPFSERVER_with _mysql .spec
144 INFO: UPX is not available.
148 INFO: Extending PYTHONPATH with paths
['C:\\Program Files\\Python38', 'C:\\Program Files\\Python38']
149 INFO: checking Analysis
149 INFO: Building Analysis because Analysis-00.toc is non existent
150 INFO: Initializing module dependency graph...
155 INFO: Caching module graph hooks...
202 INFO: Analyzing base_library.zip ...
6268 INFO: Processing pre-find module path hook   distutils
6431 INFO: distutils: retargeting to non-venv dir 'c:\\program files\\python38\\lib'
13892 INFO: Caching module dependency graph...
14037 ERROR: base_library.zip could not be created!
Traceback (most recent call last):
  File "c:\program files\python38\lib\runpy.py", line 193, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\program files\python38\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\sattha\AppData\Roaming\Python\Python38\Scripts\pyinstaller.exe\__main__.py", line 7, in <module>
  File "C:\Users\sattha\AppData\Roaming\Python\Python38\site-packages\PyInstaller\__main__.py", line 114, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "C:\Users\sattha\AppData\Roaming\Python\Python38\site-packages\PyInstaller\__main__.py", line 65, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "C:\Users\sattha\AppData\Roaming\Python\Python38\site-packages\PyInstaller\building\build_main.py", line 734, in main
    build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
  File "C:\Users\sattha\AppData\Roaming\Python\Python38\site-packages\PyInstaller\building\build_main.py", line 681, in build
    exec(code, spec_namespace)
  File "C:\Program Files\Python38\HPFSERVER_with _mysql .spec", line 6, in <module>
    a = Analysis(['HPFSERVER_with _mysql .py'],
  File "C:\Users\sattha\AppData\Roaming\Python\Python38\site-packages\PyInstaller\building\build_main.py", line 244, in __init__
    self.__postinit__()
  File "C:\Users\sattha\AppData\Roaming\Python\Python38\site-packages\PyInstaller\building\datastruct.py", line 160, in __postinit__
    self.assemble()
  File "C:\Users\sattha\AppData\Roaming\Python\Python38\site-packages\PyInstaller\building\build_main.py", line 352, in assemble
    create_py3_base_library(libzip_filename, graph=self.graph)
  File "C:\Users\sattha\AppData\Roaming\Python\Python38\site-packages\PyInstaller\depend\utils.py", line 68, in create_py3_base_library
    with zipfile.ZipFile(libzip_filename,mode = 'w') as zf:
  File "c:\program files\python38\lib\zipfile.py", line 1251, in __init__
    self.fp = io.open(file, filemode)
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Program Files\\Python38\\build\\HPFSERVER_with _mysql \\base_library.zip'

.................................................................

Ps. my program have os , pymysql library inside if it would help Thanks a lot.

sattha14902
  • 51
  • 1
  • 7
  • Try renaming the file without the spaces. – Legorooj May 10 '20 at 00:32
  • I try rename and run pyinstaller again but it's still not working and same error problem. – sattha14902 May 11 '20 at 02:08
  • `python -c "import os; print(os.path.exists('C:\\Program Files\\Python38\\build')); print(os.listdir('C:\\Program Files\\Python38\\build'))"`. What is the output? – Legorooj May 11 '20 at 02:12
  • Output is : True ['HPFSERVER_with _mysql'] – sattha14902 May 11 '20 at 04:31
  • `cd "C:\Program Files\Python38\build\HPFSERVER_with _mysql" && dir`. Edit the question and paste in the output. It's a listing of what is inside the `build` directory. – Legorooj May 11 '20 at 07:00
  • Nothing.. 11/05/2020 15:07 . 11/05/2020 15:07 .. 0 File(s) 0 bytes 2 Dir(s) 170,663,211,008 bytes free – sattha14902 May 11 '20 at 08:09
  • Odd. Can you try running from a directory in your user accout folder? (`C:\Users\MyUser\folder`) – Legorooj May 11 '20 at 08:20
  • yes i running from my user account folder, it can run normally.(meanwhile i test pyinstaller with other .py files in same directory and it can convert to exe file every file that i test but this file is not working) by the way i'm so appreciate with your help :D – sattha14902 May 11 '20 at 08:32
  • Hmm. This is odd. Can you try a virtual environment? – Legorooj May 11 '20 at 08:40
  • I have try already still stuck.I'm pretty sure it's have a problem with pymysql library because another files that not import this library it's work. – sattha14902 May 11 '20 at 10:16
  • Can you just put `import pymysql` in one of the working files and see if it still works when compiling? – Legorooj May 11 '20 at 11:02
  • It's solved Sir! ,not about the library is just about the file i don't know why: I just copy the whole code inside the trouble .py file and create new file then just paste the code and it's work.Thank you very much sir. :D – sattha14902 May 12 '20 at 02:14
  • Great! Could you add that in an answer and select it so this is marked as answered? – Legorooj May 12 '20 at 02:27

1 Answers1

1

Thanks to Mr.Legorooj I can convert .py to .exe now! How to fix this trouble 1.Just copy whole code in .py file 2.Create New .py file 3.Paste the code that you copy from old .py file in the new one. 4.use pyinstaller convert new file instead :D

sattha14902
  • 51
  • 1
  • 7