pythonpython-2.7pyinstallerciscoconfparse

PyInstaller: IOError: [Errno 2] No such file or directory: with ciscoconfparse library


I created an .exe of my python code using pyinstaller and it was working fine. But after importing this specific package "from ciscoconfparse import CiscoConfParse ", pyinstaller is able to create the .exe but when i execute the .exe it throws an error message

Please see this image link

I tried to do the workaround as mentioned in some other posts but none seem to work and this problem is seen only when i use ciscoconfparse module.

Please help how can i get around this problem, it is important to use this module.


Solution

  • Folling this link https://pythonhosted.org/PyInstaller/spec-files.html#adding-files-to-the-bundle by @AKX

    I created a spec file and added these two lines in the spec file

             datas=[(  'C:\Python27\Lib\site-packages\ciscoconfparse\*', 'ciscoconfparse' ) ],
             hiddenimports=['ciscoconfparse'],
    

    and then compiled this into an .exe using the spec file

    pyinstaller --clean -y --onefile "RR Config Scrub_v1.spec"

    Issue resolved