I am trying to use pyinstaller to package the following script:

from impala.dbapi import connect
from impala_creds import *
import base64

def main():
    conn = connect(host='impala.company.com', port=21050,
                   auth_mechanism='GSSAPI', database='default',
                   user=base64.b64decode(username), 
password=base64.b64decode(password))

    cursor = conn.cursor()

    cursor.close()
    conn.close()

if __name__ == '__main__':
    main()


I have created the exe but it fails with the message:


Traceback (most recent call last):
  File "native_test.py", line 1, in <module>
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File 
"c:\programdata\anaconda3\lib\site-packages\PyInstaller\loader\pyimod03_importers.py",
 line 627, in exec_module
  File "site-packages\impala\dbapi.py", line 28, in <module>
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File 
"c:\programdata\anaconda3\lib\site-packages\PyInstaller\loader\pyimod03_importers.py",
 line 627, in exec_module
  File "site-packages\impala\hiveserver2.py", line 33, in <module>
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File 
"c:\programdata\anaconda3\lib\site-packages\PyInstaller\loader\pyimod03_importers.py",
 line 627, in exec_module
  File "site-packages\impala\_thrift_api.py", line 79, in <module>
  File "site-packages\thriftpy2\parser\__init__.py", line 33, in load
  File "site-packages\thriftpy2\parser\parser.py", line 564, in parse
FileNotFoundError: [Errno 2] No such file or directory: 
'C:\\Users\\sreyan32\\AppData\\Local\\Temp\\1\\_MEI64882\\impala\\thrift\\ExecStats.thrift'
[7716] Failed to execute script native_test



The impala library loads a file from :


C:\ProgramData\Anaconda3\Lib\site-packages\impala\thrift\ExecStats.thrift


I have tried including the file in the final build using --add-data option like 
the following:


pyinstaller --onefile --add-data 
"C:\ProgramData\Anaconda3\Lib\site-packages\impala\thrift\ExecStats.thrift;impala\thrift\ExecStats.thrift"
 native_test.spec


But I still fail with the same error. I have also tried adding the file by 
adding a Tree() in the spec file's EXE block, but no change. 


What am I doing wrong ?




-- 
You received this message because you are subscribed to the Google Groups 
"PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pyinstaller/407cb8a7-ab29-4993-a6fc-417c3755cdf9%40googlegroups.com.

Reply via email to