oracle / python-cx_Oracle

Python interface to Oracle Database now superseded by python-oracledb
https://oracle.github.io/python-cx_Oracle
Other
890 stars 361 forks source link

Cannot locate a 64-bit Oracle Client library: "The specified module could not be found" #612

Closed liudonghua123 closed 2 years ago

liudonghua123 commented 2 years ago
  1. What versions are you using? 8.3.0

Give your database version. Oracle 12c

Also run Python and show the output of:

import sys
import platform

print("platform.platform:", platform.platform())
print("sys.maxsize > 2**32:", sys.maxsize > 2**32)
print("platform.python_version:", platform.python_version())

And:

import cx_Oracle
print("cx_Oracle.version:", cx_Oracle.version)
print("cx_Oracle.clientversion:", cx_Oracle.clientversion())
D:\code\python\ecard-app>python info1.py
platform.platform: Windows-10-10.0.22000-SP0
sys.maxsize > 2**32: True
platform.python_version: 3.10.2

D:\code\python\ecard-app>python info2.py
cx_Oracle.version: 8.3.0
Traceback (most recent call last):
  File "D:\code\python\ecard-app\info2.py", line 3, in <module>
    print("cx_Oracle.clientversion:", cx_Oracle.clientversion())
cx_Oracle.DatabaseError: DPI-1047: Cannot locate a 64-bit Oracle Client library: "The specified module could not be found". See https://cx-oracle.readthedocs.io/en/latest/user_guide/installation.html for help

D:\code\python\ecard-app>
  1. Is it an error or a hang or a crash? crash

  2. What error(s) or behavior you are seeing?

I use this package in my python app, and I have configured oracle instant client by adding D:\apps\oracle\instantclient_19_8 to the path environment. When I tried to connect to the remote oracle database, I got Cannot locate a 64-bit Oracle Client library: "The specified module could not be found" error. However If I packaged the app using pyinstaller and execute the exe, the it worked.

The following is some logs of these steps.

# https://oracle.github.io/odpi/doc/installation.html#oracle-client-library-loading
D:\code\python\ecard-app>set DPI_DEBUG_LEVEL=64
D:\code\python\ecard-app>python ecard.py
ODPI [09144] 2022-02-24 14:41:35.981: ODPI-C 4.3.0
ODPI [09144] 2022-02-24 14:41:35.981: debugging messages initialized at level 64
......
ODPI [09144] 2022-02-24 14:41:39.371: Context Parameters:
ODPI [09144] 2022-02-24 14:41:39.371: Environment Variables:
ODPI [09144] 2022-02-24 14:41:39.371:     PATH => "C:\Users\Liu.D.H\AppData\Roaming\Composer\vendor\bin;C:\Program Files (x86)\VMware\VMware Workstation\bin\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Users\Liu.D.H\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Program Files\Git\cmd;C:\Program Files (x86)\NetSarang\Xshell 7\;C:\Program Files (x86)\NetSarang\Xftp 7\;C:\ProgramData\chocolatey\bin;C:\Users\Liu.D.H\.wasmer\bin;C:\Users\Liu.D.H\.wasmer\globals\wapm_packages\.bin;C:\Program Files\mvndaemon\mvnd-0.7.1-windows-amd64\bin;C:\msys64\usr\bin;C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin;C:\Library\Swift-development\bin;C:\Library\icu-67\usr\bin;C:\Program Files\MiKTeX\miktex\bin\x64\;D:\apps\微信web开发者工具\dll;C:\Program Files\Git LFS;C:\Program Files\LLVM\bin;C:\Users\Liu.D.H\scoop\shims;C:\Users\Liu.D.H/.local/bin;C:\Users\Liu.D.H\AppData\Roaming\npm;C:\Users\Liu.D.H\.cargo\bin;C:\Users\Liu.D.H\AppData\Local\Microsoft\WindowsApps;C:\Users\Liu.D.H\anaconda3;C:\Users\Liu.D.H\anaconda3\Library\mingw-w64\bin;C:\Users\Liu.D.H\anaconda3\Library\usr\bin;C:\Users\Liu.D.H\anaconda3\Library\bin;C:\Users\Liu.D.H\anaconda3\Scripts;C:\Users\Liu.D.H\.dotnet\tools;C:\Users\Liu.D.H\AppData\Local\Programs\Microsoft VS Code\bin;D:\android\android_sdk\tools;D:\android\android_sdk\tools\bin;D:\android\android_sdk\platform-tools;D:\android\android_sdk\cmdline-tools\latest\bin;D:\android\android_sdk\build-tools\29.0.3;D:\android\android_sdk\ndk-bundle;C:\Program Files\Java\jdk-17\bin;D:\apps\flutter\bin;D:\apps\flutter\bin\cache\dart-sdk\bin;D:\apps\apache-maven-3.8.4\bin;D:\apps\ffmpeg-5.0-full_build\bin;D:\apps\ImageMagick-7.1.0-portable-Q16-HDRI-x64;D:\apps;D:\apps\bin;C:\Program Files\Sublime Text;C:\Program Files\JetBrains\DataGrip 2021.3.1\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Users\Liu.D.H\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Scripts;C:\Program Files\CMake\bin;D:\apps\graphicsmagick-1.3.36-q16;D:\apps\WasmEdge-0.9.1-windows\bin;C:\tools\msys64;C:\Users\Liu.D.H\AppData\Local\Pub\Cache\bin;C:\Program Files\JetBrains\IntelliJ IDEA 2021.3.1\bin;D:\apps\binaryen-version_105-x86_64-windows\bin;D:\apps\oracle\instantclient_19_8;"
ODPI [09144] 2022-02-24 14:41:39.371: check module directory
ODPI [09144] 2022-02-24 14:41:39.371: module name is C:\Users\Liu.D.H\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\cx_Oracle.cp310-win_amd64.pyd
ODPI [09144] 2022-02-24 14:41:39.371: load in dir C:\Users\Liu.D.H\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages
ODPI [09144] 2022-02-24 14:41:39.371: load with name C:\Users\Liu.D.H\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages/oci.dll
ODPI [09144] 2022-02-24 14:41:39.372: load by OS failure: The specified module could not be found
ODPI [09144] 2022-02-24 14:41:39.372: load with OS search heuristics
ODPI [09144] 2022-02-24 14:41:39.372: load with name oci.dll
ODPI [09144] 2022-02-24 14:41:39.372: load by OS failure: The specified module could not be found
DPI-1047: Cannot locate a 64-bit Oracle Client library: "The specified module could not be found". See https://cx-oracle.readthedocs.io/en/latest/user_guide/installation.html for help
......
D:\code\python\ecard-app>dist\ecard\ecard.exe
......
ODPI [26476] 2022-02-24 14:42:49.808: Context Parameters:
ODPI [26476] 2022-02-24 14:42:49.811: Environment Variables:
ODPI [26476] 2022-02-24 14:42:49.813:     PATH => "C:\Users\Liu.D.H\AppData\Roaming\Composer\vendor\bin;C:\Program Files (x86)\VMware\VMware Workstation\bin\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Users\Liu.D.H\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Program Files\Git\cmd;C:\Program Files (x86)\NetSarang\Xshell 7\;C:\Program Files (x86)\NetSarang\Xftp 7\;C:\ProgramData\chocolatey\bin;C:\Users\Liu.D.H\.wasmer\bin;C:\Users\Liu.D.H\.wasmer\globals\wapm_packages\.bin;C:\Program Files\mvndaemon\mvnd-0.7.1-windows-amd64\bin;C:\msys64\usr\bin;C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin;C:\Library\Swift-development\bin;C:\Library\icu-67\usr\bin;C:\Program Files\MiKTeX\miktex\bin\x64\;D:\apps\微信web开发者工具\dll;C:\Program Files\Git LFS;C:\Program Files\LLVM\bin;C:\Users\Liu.D.H\scoop\shims;C:\Users\Liu.D.H/.local/bin;C:\Users\Liu.D.H\AppData\Roaming\npm;C:\Users\Liu.D.H\.cargo\bin;C:\Users\Liu.D.H\AppData\Local\Microsoft\WindowsApps;C:\Users\Liu.D.H\anaconda3;C:\Users\Liu.D.H\anaconda3\Library\mingw-w64\bin;C:\Users\Liu.D.H\anaconda3\Library\usr\bin;C:\Users\Liu.D.H\anaconda3\Library\bin;C:\Users\Liu.D.H\anaconda3\Scripts;C:\Users\Liu.D.H\.dotnet\tools;C:\Users\Liu.D.H\AppData\Local\Programs\Microsoft VS Code\bin;D:\android\android_sdk\tools;D:\android\android_sdk\tools\bin;D:\android\android_sdk\platform-tools;D:\android\android_sdk\cmdline-tools\latest\bin;D:\android\android_sdk\build-tools\29.0.3;D:\android\android_sdk\ndk-bundle;C:\Program Files\Java\jdk-17\bin;D:\apps\flutter\bin;D:\apps\flutter\bin\cache\dart-sdk\bin;D:\apps\apache-maven-3.8.4\bin;D:\apps\ffmpeg-5.0-full_build\bin;D:\apps\ImageMagick-7.1.0-portable-Q16-HDRI-x64;D:\apps;D:\apps\bin;C:\Program Files\Sublime Text;C:\Program Files\JetBrains\DataGrip 2021.3.1\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Users\Liu.D.H\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Scripts;C:\Program Files\CMake\bin;D:\apps\graphicsmagick-1.3.36-q16;D:\apps\WasmEdge-0.9.1-windows\bin;C:\tools\msys64;C:\Users\Liu.D.H\AppData\Local\Pub\Cache\bin;C:\Program Files\JetBrains\IntelliJ IDEA 2021.3.1\bin;D:\apps\binaryen-version_105-x86_64-windows\bin;D:\apps\oracle\instantclient_19_8;"
ODPI [26476] 2022-02-24 14:42:49.882: check module directory
ODPI [26476] 2022-02-24 14:42:49.884: module name is D:\code\python\ecard-app\dist\ecard\cx_Oracle.cp310-win_amd64.pyd
ODPI [26476] 2022-02-24 14:42:49.889: load in dir D:\code\python\ecard-app\dist\ecard
ODPI [26476] 2022-02-24 14:42:49.891: load with name D:\code\python\ecard-app\dist\ecard/oci.dll
ODPI [26476] 2022-02-24 14:42:49.894: load by OS failure: The specified module could not be found
ODPI [26476] 2022-02-24 14:42:49.897: load with OS search heuristics
ODPI [26476] 2022-02-24 14:42:49.898: load with name oci.dll
ODPI [26476] 2022-02-24 14:42:49.902: load by OS successful
ODPI [26476] 2022-02-24 14:42:49.903: validating loaded library
......

I also add some code to check the oci.dll in PATH. Both of them passed.

def check_env():
    print(f'os.environ["PATH"]: {os.environ["PATH"]}')
    print(f'os.system("where oci.dll"): {os.system("where oci.dll")}')

check_env()
cjbj commented 2 years ago
liudonghua123 commented 2 years ago
  • Please clarify what you mean about running the pyinstaller exe. Did you run that on the same machine?

I tried to use pyinstaller to package the python app. Yes I run on the same machine.

I only use PATH, If I use init_oracle_client(lib_dir=...), then no problem.

  • Do you need to reboot or restart a terminal window to get PATH set?

I restarted the terminal window, and I also checked PATH and where oci.dll in my code.

sharadraju commented 2 years ago

@liudonghua123, What I understand is: Your apps works if you use the init_oracle_client(lib_dir=...)function to initialize the Oracle client libraries, but not when you set the client library path on the PATH environment variable. Is my understanding right? If so, is there any reason you do not want to use the init_oracle_client function?

cjbj commented 2 years ago

I'm also interested to know why init_oracle_client() isn't being used.

Unrelated to your problem: you should upgrade to the latest Release Update, which is 19.14

liudonghua123 commented 2 years ago

What I understand is: Your apps works if you use the init_oracle_client(lib_dir=...) function to initialize the Oracle client libraries, but not when you set the client library path on the PATH environment variable. Is my understanding right? If so, is there any reason you do not want to use the init_oracle_client function?

@sharadraju Yes, you understanding is right, I want to deploy the app to other machine which configured oracle instantclient in their own location. So I did not want to use init_oracle_client manully.

@cjbj

Do you have any other oci.dll files on your machine, perhaps that are in your PATH and therefore get loaded before D:\apps\oracle\instantclient_19_8?

Yes, I have tried a few different version of oracle instant client. And I can confirm that I used the right architecture with my python.

Try putting D:\apps\oracle\instantclient_19_8 first in PATH

I don't think that is matters, From the output of the above logs. The PATH when I execute the app via python script.py or script.exe is the same. I wonder why script.exe worked and python script.py did not worked.

cjbj commented 2 years ago

Please try changing PATH as suggested. I can see the PATH look the same, but ....

liudonghua123 commented 2 years ago

I have changed the PATH as you sugguested, and the results is the same.

I have also included the following test code.

def check_env():
    print(f'os.environ["PATH"]: {os.environ["PATH"]}')
    print(f'os.system("where oci.dll"): {os.system("where oci.dll")}')

check_env()
The full logs ```shell D:\code\python\ecard-app>path PATH=C:\Users\Liu.D.H\AppData\Roaming\Composer\vendor\bin;C:\Program Files (x86)\VMware\VMware Workstation\bin\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Users\Liu.D.H\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Program Files\Git\cmd;C:\Program Files (x86)\NetSarang\Xshell 7\;C:\Program Files (x86)\NetSarang\Xftp 7\;C:\ProgramData\chocolatey\bin;C:\Users\Liu.D.H\.wasmer\bin;C:\Users\Liu.D.H\.wasmer\globals\wapm_packages\.bin;C:\Program Files\mvndaemon\mvnd-0.7.1-windows-amd64\bin;C:\msys64\usr\bin;C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin;C:\Library\Swift-development\bin;C:\Library\icu-67\usr\bin;C:\Program Files\MiKTeX\miktex\bin\x64\;D:\apps\微信web开发者工具\dll;C:\Program Files\Git LFS;C:\Program Files\LLVM\bin;C:\Users\Liu.D.H\scoop\shims;C:\Users\Liu.D.H/.local/bin;C:\Users\Liu.D.H\AppData\Roaming\npm;C:\Users\Liu.D.H\.cargo\bin;C:\Users\Liu.D.H\AppData\Local\Microsoft\WindowsApps;C:\Users\Liu.D.H\anaconda3;C:\Users\Liu.D.H\anaconda3\Library\mingw-w64\bin;C:\Users\Liu.D.H\anaconda3\Library\usr\bin;C:\Users\Liu.D.H\anaconda3\Library\bin;C:\Users\Liu.D.H\anaconda3\Scripts;C:\Users\Liu.D.H\.dotnet\tools;C:\Users\Liu.D.H\AppData\Local\Programs\Microsoft VS Code\bin;D:\android\android_sdk\tools;D:\android\android_sdk\tools\bin;D:\android\android_sdk\platform-tools;D:\android\android_sdk\cmdline-tools\latest\bin;D:\android\android_sdk\build-tools\29.0.3;D:\android\android_sdk\ndk-bundle;C:\Program Files\Java\jdk-17\bin;D:\apps\flutter\bin;D:\apps\flutter\bin\cache\dart-sdk\bin;D:\apps\apache-maven-3.8.4\bin;D:\apps\ffmpeg-5.0-full_build\bin;D:\apps\ImageMagick-7.1.0-portable-Q16-HDRI-x64;D:\apps;D:\apps\bin;C:\Program Files\Sublime Text;C:\Program Files\JetBrains\DataGrip 2021.3.1\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Users\Liu.D.H\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Scripts;C:\Program Files\CMake\bin;D:\apps\graphicsmagick-1.3.36-q16;D:\apps\WasmEdge-0.9.1-windows\bin;C:\tools\msys64;C:\Users\Liu.D.H\AppData\Local\Pub\Cache\bin;C:\Program Files\JetBrains\IntelliJ IDEA 2021.3.1\bin;D:\apps\binaryen-version_105-x86_64-windows\bin;D:\apps\oracle\instantclient_19_8; D:\code\python\ecard-app>set PATH=D:\apps\oracle\instantclient_19_8;%PATH% D:\code\python\ecard-app>set DPI_DEBUG_LEVEL=64 D:\code\python\ecard-app>python ecard.py ODPI [27492] 2022-02-25 10:33:36.911: ODPI-C 4.3.0 ODPI [27492] 2022-02-25 10:33:36.911: debugging messages initialized at level 64 os.environ["PATH"]: D:\apps\oracle\instantclient_19_8;C:\Users\Liu.D.H\AppData\Roaming\Composer\vendor\bin;C:\Program Files (x86)\VMware\VMware Workstation\bin\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Users\Liu.D.H\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Program Files\Git\cmd;C:\Program Files (x86)\NetSarang\Xshell 7\;C:\Program Files (x86)\NetSarang\Xftp 7\;C:\ProgramData\chocolatey\bin;C:\Users\Liu.D.H\.wasmer\bin;C:\Users\Liu.D.H\.wasmer\globals\wapm_packages\.bin;C:\Program Files\mvndaemon\mvnd-0.7.1-windows-amd64\bin;C:\msys64\usr\bin;C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin;C:\Library\Swift-development\bin;C:\Library\icu-67\usr\bin;C:\Program Files\MiKTeX\miktex\bin\x64\;D:\apps\微信web开发者工具\dll;C:\Program Files\Git LFS;C:\Program Files\LLVM\bin;C:\Users\Liu.D.H\scoop\shims;C:\Users\Liu.D.H/.local/bin;C:\Users\Liu.D.H\AppData\Roaming\npm;C:\Users\Liu.D.H\.cargo\bin;C:\Users\Liu.D.H\AppData\Local\Microsoft\WindowsApps;C:\Users\Liu.D.H\anaconda3;C:\Users\Liu.D.H\anaconda3\Library\mingw-w64\bin;C:\Users\Liu.D.H\anaconda3\Library\usr\bin;C:\Users\Liu.D.H\anaconda3\Library\bin;C:\Users\Liu.D.H\anaconda3\Scripts;C:\Users\Liu.D.H\.dotnet\tools;C:\Users\Liu.D.H\AppData\Local\Programs\Microsoft VS Code\bin;D:\android\android_sdk\tools;D:\android\android_sdk\tools\bin;D:\android\android_sdk\platform-tools;D:\android\android_sdk\cmdline-tools\latest\bin;D:\android\android_sdk\build-tools\29.0.3;D:\android\android_sdk\ndk-bundle;C:\Program Files\Java\jdk-17\bin;D:\apps\flutter\bin;D:\apps\flutter\bin\cache\dart-sdk\bin;D:\apps\apache-maven-3.8.4\bin;D:\apps\ffmpeg-5.0-full_build\bin;D:\apps\ImageMagick-7.1.0-portable-Q16-HDRI-x64;D:\apps;D:\apps\bin;C:\Program Files\Sublime Text;C:\Program Files\JetBrains\DataGrip 2021.3.1\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Users\Liu.D.H\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Scripts;C:\Program Files\CMake\bin;D:\apps\graphicsmagick-1.3.36-q16;D:\apps\WasmEdge-0.9.1-windows\bin;C:\tools\msys64;C:\Users\Liu.D.H\AppData\Local\Pub\Cache\bin;C:\Program Files\JetBrains\IntelliJ IDEA 2021.3.1\bin;D:\apps\binaryen-version_105-x86_64-windows\bin;D:\apps\oracle\instantclient_19_8; D:\apps\oracle\instantclient_19_8\oci.dll os.system("where oci.dll"): 0 conn.connect()... ODPI [27492] 2022-02-25 10:33:40.183: Context Parameters: ODPI [27492] 2022-02-25 10:33:40.184: Environment Variables: ODPI [27492] 2022-02-25 10:33:40.184: PATH => "D:\apps\oracle\instantclient_19_8;C:\Users\Liu.D.H\AppData\Roaming\Composer\vendor\bin;C:\Program Files (x86)\VMware\VMware Workstation\bin\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Users\Liu.D.H\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Program Files\Git\cmd;C:\Program Files (x86)\NetSarang\Xshell 7\;C:\Program Files (x86)\NetSarang\Xftp 7\;C:\ProgramData\chocolatey\bin;C:\Users\Liu.D.H\.wasmer\bin;C:\Users\Liu.D.H\.wasmer\globals\wapm_packages\.bin;C:\Program Files\mvndaemon\mvnd-0.7.1-windows-amd64\bin;C:\msys64\usr\bin;C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin;C:\Library\Swift-development\bin;C:\Library\icu-67\usr\bin;C:\Program Files\MiKTeX\miktex\bin\x64\;D:\apps\微信web开发者工具\dll;C:\Program Files\Git LFS;C:\Program Files\LLVM\bin;C:\Users\Liu.D.H\scoop\shims;C:\Users\Liu.D.H/.local/bin;C:\Users\Liu.D.H\AppData\Roaming\npm;C:\Users\Liu.D.H\.cargo\bin;C:\Users\Liu.D.H\AppData\Local\Microsoft\WindowsApps;C:\Users\Liu.D.H\anaconda3;C:\Users\Liu.D.H\anaconda3\Library\mingw-w64\bin;C:\Users\Liu.D.H\anaconda3\Library\usr\bin;C:\Users\Liu.D.H\anaconda3\Library\bin;C:\Users\Liu.D.H\anaconda3\Scripts;C:\Users\Liu.D.H\.dotnet\tools;C:\Users\Liu.D.H\AppData\Local\Programs\Microsoft VS Code\bin;D:\android\android_sdk\tools;D:\android\android_sdk\tools\bin;D:\android\android_sdk\platform-tools;D:\android\android_sdk\cmdline-tools\latest\bin;D:\android\android_sdk\build-tools\29.0.3;D:\android\android_sdk\ndk-bundle;C:\Program Files\Java\jdk-17\bin;D:\apps\flutter\bin;D:\apps\flutter\bin\cache\dart-sdk\bin;D:\apps\apache-maven-3.8.4\bin;D:\apps\ffmpeg-5.0-full_build\bin;D:\apps\ImageMagick-7.1.0-portable-Q16-HDRI-x64;D:\apps;D:\apps\bin;C:\Program Files\Sublime Text;C:\Program Files\JetBrains\DataGrip 2021.3.1\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Users\Liu.D.H\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Scripts;C:\Program Files\CMake\bin;D:\apps\graphicsmagick-1.3.36-q16;D:\apps\WasmEdge-0.9.1-windows\bin;C:\tools\msys64;C:\Users\Liu.D.H\AppData\Local\Pub\Cache\bin;C:\Program Files\JetBrains\IntelliJ IDEA 2021.3.1\bin;D:\apps\binaryen-version_105-x86_64-windows\bin;D:\apps\oracle\instantclient_19_8;" ODPI [27492] 2022-02-25 10:33:40.184: check module directory ODPI [27492] 2022-02-25 10:33:40.184: module name is C:\Users\Liu.D.H\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\cx_Oracle.cp310-win_amd64.pyd ODPI [27492] 2022-02-25 10:33:40.184: load in dir C:\Users\Liu.D.H\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages ODPI [27492] 2022-02-25 10:33:40.184: load with name C:\Users\Liu.D.H\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages/oci.dll ODPI [27492] 2022-02-25 10:33:40.184: load by OS failure: The specified module could not be found ODPI [27492] 2022-02-25 10:33:40.185: load with OS search heuristics ODPI [27492] 2022-02-25 10:33:40.185: load with name oci.dll ODPI [27492] 2022-02-25 10:33:40.185: load by OS failure: The specified module could not be found 数据库连接失败,请检查网络或联系开发人员 DPI-1047: Cannot locate a 64-bit Oracle Client library: "The specified module could not be found". See https://cx-oracle.readthedocs.io/en/latest/user_guide/installation.html for help Exception in Tkinter callback Traceback (most recent call last): File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.752.0_x64__qbz5n2kfra8p0\lib\tkinter\__init__.py", line 1921, in __call__ return self.func(*args) File "D:\code\python\ecard-app\ecard.py", line 189, in func data1 = ora1.get_data(sql1) File "D:\code\python\ecard-app\ecard.py", line 39, in get_data self.cursor.execute(sql) AttributeError: 'ConnectToOracle' object has no attribute 'cursor' D:\code\python\ecard-app>d D:\code\python\ecard-app>dist\ecard\ecard.exe [24716] PyInstaller Bootloader 3.x [24716] LOADER: executable is D:\code\python\ecard-app\dist\ecard\ecard.exe [24716] LOADER: homepath is D:\code\python\ecard-app\dist\ecard [24716] LOADER: _MEIPASS2 is NULL [24716] LOADER: archivename is D:\code\python\ecard-app\dist\ecard\ecard.exe [24716] LOADER: Cookie found at offset 0x436E9 [24716] LOADER: No need to extract files to run; setting extractionpath to homepath [24716] LOADER: SetDllDirectory(D:\code\python\ecard-app\dist\ecard) [24716] LOADER: Already in the child - running user's code. [24716] LOADER: Python library: D:\code\python\ecard-app\dist\ecard\python310.dll [24716] LOADER: Loaded functions from Python library. [24716] LOADER: Manipulating environment (sys.path, sys.prefix) [24716] LOADER: sys.prefix is D:\code\python\ecard-app\dist\ecard [24716] LOADER: Pre-init sys.path is D:\code\python\ecard-app\dist\ecard\base_library.zip;D:\code\python\ecard-app\dist\ecard\lib-dynload;D:\code\python\ecard-app\dist\ecard [24716] LOADER: Setting runtime options [24716] LOADER: Runtime option: v [24716] LOADER: Initializing python import _frozen_importlib # frozen import _imp # builtin import '_thread' # import '_warnings' # import '_weakref' # import '_io' # import 'marshal' # import 'nt' # import 'winreg' # import '_frozen_importlib_external' # # installing zipimport hook import 'time' # import 'zipimport' # # installed zipimport hook # zipimport: found 147 names in 'D:\\code\\python\\ecard-app\\dist\\ecard\\base_library.zip' import '_codecs' # import 'codecs' # import 'encodings.aliases' # import 'encodings' # import 'encodings.utf_8' # import '_codecs_cn' # import '_multibytecodec' # import 'encodings.gbk' # import '_signal' # import '_abc' # import 'abc' # import 'io' # [24716] LOADER: Overriding Python's sys.path [24716] LOADER: Post-init sys.path is D:\code\python\ecard-app\dist\ecard\base_library.zip;D:\code\python\ecard-app\dist\ecard\lib-dynload;D:\code\python\ecard-app\dist\ecard [24716] LOADER: Setting sys.argv [24716] LOADER: setting sys._MEIPASS [24716] LOADER: importing modules from CArchive [24716] LOADER: extracted struct [24716] LOADER: running unmarshalled code object for struct... import '_struct' # [24716] LOADER: extracted pyimod01_os_path [24716] LOADER: running unmarshalled code object for pyimod01_os_path... [24716] LOADER: extracted pyimod02_archive [24716] LOADER: running unmarshalled code object for pyimod02_archive... import 'zlib' # [24716] LOADER: extracted pyimod03_importers [24716] LOADER: running unmarshalled code object for pyimod03_importers... [24716] LOADER: extracted pyimod04_ctypes [24716] LOADER: running unmarshalled code object for pyimod04_ctypes... [24716] LOADER: Installing PYZ archive with Python modules. [24716] LOADER: PYZ archive: PYZ-00.pyz [24716] LOADER: Running pyiboot01_bootstrap.py # PyInstaller: FrozenImporter(D:\code\python\ecard-app\dist\ecard\ecard.exe?275571) # os not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\ecard\\os.pyc' # stat not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\ecard\\stat.pyc' import '_stat' # import 'stat' # <_frozen_importlib_external.SourcelessFileLoader object at 0x00000154ABA11720> # _collections_abc not found in PYZ import '_collections_abc' # # ntpath not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\ecard\\ntpath.pyc' # genericpath not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\ecard\\genericpath.pyc' import 'genericpath' # <_frozen_importlib_external.SourcelessFileLoader object at 0x00000154ABA48B20> import 'ntpath' # <_frozen_importlib_external.SourcelessFileLoader object at 0x00000154ABA11A80> import 'os' # <_frozen_importlib_external.SourcelessFileLoader object at 0x00000154ABA10250> # ctypes not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\ecard\\ctypes\\__init__.pyc' # types not found in PYZ import 'types' # # _ctypes not found in PYZ # extension module '_ctypes' loaded from 'D:\\code\\python\\ecard-app\\dist\\ecard\\_ctypes.pyd' # extension module '_ctypes' executed from 'D:\\code\\python\\ecard-app\\dist\\ecard\\_ctypes.pyd' import '_ctypes' # <_frozen_importlib_external.ExtensionFileLoader object at 0x00000154ABA4A020> # ctypes._endian not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\ecard\\ctypes\\_endian.pyc' import 'ctypes._endian' # <_frozen_importlib_external.SourcelessFileLoader object at 0x00000154ABA4B010> import 'ctypes' # <_frozen_importlib_external.SourcelessFileLoader object at 0x00000154ABA11450> [24716] LOADER: Running pyi_rth_inspect.py # inspect not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\ecard\\inspect.pyc' # ast not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\ecard\\ast.pyc' import '_ast' # # contextlib not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\ecard\\contextlib.pyc' # collections not found in PYZ import 'itertools' # # keyword not found in PYZ import 'keyword' # # operator not found in PYZ import '_operator' # import 'operator' # # reprlib not found in PYZ import 'reprlib' # import '_collections' # import 'collections' # # functools not found in PYZ import '_functools' # import 'functools' # import 'contextlib' # <_frozen_importlib_external.SourcelessFileLoader object at 0x00000154AD5C95D0> # enum not found in PYZ import 'enum' # import 'ast' # <_frozen_importlib_external.SourcelessFileLoader object at 0x00000154ABA954E0> # dis not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\ecard\\dis.pyc' # opcode not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\ecard\\opcode.pyc' import '_opcode' # import 'opcode' # <_frozen_importlib_external.SourcelessFileLoader object at 0x00000154AD63E530> import 'dis' # <_frozen_importlib_external.SourcelessFileLoader object at 0x00000154ABA95C60> # collections.abc not found in PYZ import 'collections.abc' # # importlib not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\ecard\\importlib\\__init__.pyc' # warnings not found in PYZ import 'warnings' # import 'importlib' # <_frozen_importlib_external.SourcelessFileLoader object at 0x00000154AD63F400> # importlib.machinery not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\ecard\\importlib\\machinery.pyc' import 'importlib.machinery' # <_frozen_importlib_external.SourcelessFileLoader object at 0x00000154AD63EBF0> # linecache not found in PYZ # tokenize not found in PYZ # re not found in PYZ # sre_compile not found in PYZ import '_sre' # # sre_parse not found in PYZ # sre_constants not found in PYZ import 'sre_constants' # import 'sre_parse' # import 'sre_compile' # import '_locale' # # copyreg not found in PYZ import 'copyreg' # import 're' # # token not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\ecard\\token.pyc' import 'token' # <_frozen_importlib_external.SourcelessFileLoader object at 0x00000154AD67B400> import 'tokenize' # import 'linecache' # import 'inspect' # <_frozen_importlib_external.SourcelessFileLoader object at 0x00000154ABA4B250> [24716] LOADER: Running pyi_rth_subprocess.py # subprocess not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\ecard\\subprocess.pyc' import 'errno' # # signal not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\ecard\\signal.pyc' import 'signal' # <_frozen_importlib_external.SourcelessFileLoader object at 0x00000154AD6AA9E0> # threading not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\ecard\\threading.pyc' # _weakrefset not found in PYZ import '_weakrefset' # import 'threading' # <_frozen_importlib_external.SourcelessFileLoader object at 0x00000154AD6AACB0> # fcntl not found in PYZ import 'msvcrt' # import '_winapi' # import 'subprocess' # <_frozen_importlib_external.SourcelessFileLoader object at 0x00000154AD6AA110> [24716] LOADER: Running pyi_rth_pkgutil.py # pkgutil not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\ecard\\pkgutil.pyc' # importlib.util not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\ecard\\importlib\\util.pyc' # importlib._abc not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\ecard\\importlib\\_abc.pyc' import 'importlib._abc' # <_frozen_importlib_external.SourcelessFileLoader object at 0x00000154AD6DE020> import 'importlib.util' # <_frozen_importlib_external.SourcelessFileLoader object at 0x00000154AD6DD810> # weakref not found in PYZ import 'weakref' # import 'pkgutil' # <_frozen_importlib_external.SourcelessFileLoader object at 0x00000154AD6AA5F0> [24716] LOADER: Running pyi_rth_multiprocessing.py # multiprocessing not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\ecard\\multiprocessing\\__init__.pyc' # multiprocessing.context not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\ecard\\multiprocessing\\context.pyc' # multiprocessing.process not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\ecard\\multiprocessing\\process.pyc' import 'multiprocessing.process' # <_frozen_importlib_external.SourcelessFileLoader object at 0x00000154AD71D030> # multiprocessing.reduction not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\ecard\\multiprocessing\\reduction.pyc' # pickle not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\ecard\\pickle.pyc' # _compat_pickle not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\ecard\\_compat_pickle.pyc' import '_compat_pickle' # <_frozen_importlib_external.SourcelessFileLoader object at 0x00000154AD754940> import '_pickle' # # org not found in PYZ import 'pickle' # <_frozen_importlib_external.SourcelessFileLoader object at 0x00000154AD71E410> # socket not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\ecard\\socket.pyc' # _socket not found in PYZ # extension module '_socket' loaded from 'D:\\code\\python\\ecard-app\\dist\\ecard\\_socket.pyd' # extension module '_socket' executed from 'D:\\code\\python\\ecard-app\\dist\\ecard\\_socket.pyd' import '_socket' # <_frozen_importlib_external.ExtensionFileLoader object at 0x00000154AD755540> # selectors not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\ecard\\selectors.pyc' import 'math' # # select not found in PYZ # extension module 'select' loaded from 'D:\\code\\python\\ecard-app\\dist\\ecard\\select.pyd' # extension module 'select' executed from 'D:\\code\\python\\ecard-app\\dist\\ecard\\select.pyd' import 'select' # <_frozen_importlib_external.ExtensionFileLoader object at 0x00000154AD7560E0> import 'selectors' # <_frozen_importlib_external.SourcelessFileLoader object at 0x00000154AD755660> import 'socket' # <_frozen_importlib_external.SourcelessFileLoader object at 0x00000154AD71F310> import 'multiprocessing.reduction' # <_frozen_importlib_external.SourcelessFileLoader object at 0x00000154AD71DAB0> import 'multiprocessing.context' # <_frozen_importlib_external.SourcelessFileLoader object at 0x00000154AD6DFDF0> import 'multiprocessing' # <_frozen_importlib_external.SourcelessFileLoader object at 0x00000154AD6DFAC0> # multiprocessing.spawn not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\ecard\\multiprocessing\\spawn.pyc' # runpy not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\ecard\\runpy.pyc' import 'runpy' # <_frozen_importlib_external.SourcelessFileLoader object at 0x00000154AD756F50> # multiprocessing.util not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\ecard\\multiprocessing\\util.pyc' import 'atexit' # import 'multiprocessing.util' # <_frozen_importlib_external.SourcelessFileLoader object at 0x00000154AD757370> import 'multiprocessing.spawn' # <_frozen_importlib_external.SourcelessFileLoader object at 0x00000154AD6DFBB0> # multiprocessing.popen_spawn_win32 not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\ecard\\multiprocessing\\popen_spawn_win32.pyc' import 'multiprocessing.popen_spawn_win32' # <_frozen_importlib_external.SourcelessFileLoader object at 0x00000154AD757C70> [24716] LOADER: Running pyi_rth__tkinter.py [24716] LOADER: Running ecard.py # tkinter not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\ecard\\tkinter\\__init__.pyc' # _tkinter not found in PYZ # extension module '_tkinter' loaded from 'D:\\code\\python\\ecard-app\\dist\\ecard\\_tkinter.pyd' # extension module '_tkinter' executed from 'D:\\code\\python\\ecard-app\\dist\\ecard\\_tkinter.pyd' import '_tkinter' # <_frozen_importlib_external.ExtensionFileLoader object at 0x00000154AD9ABDF0> # tkinter.constants not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\ecard\\tkinter\\constants.pyc' import 'tkinter.constants' # <_frozen_importlib_external.SourcelessFileLoader object at 0x00000154AD9ABFD0> import 'tkinter' # <_frozen_importlib_external.SourcelessFileLoader object at 0x00000154AD9A8310> # cx_Oracle not found in PYZ ODPI [27292] 2022-02-25 10:35:12.006: ODPI-C 4.3.0 ODPI [27292] 2022-02-25 10:35:12.008: debugging messages initialized at level 64 # datetime not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\ecard\\datetime.pyc' import '_datetime' # import 'datetime' # <_frozen_importlib_external.SourcelessFileLoader object at 0x00000154AD9AB700> # decimal not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\ecard\\decimal.pyc' # _decimal not found in PYZ # numbers not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\ecard\\numbers.pyc' import 'numbers' # <_frozen_importlib_external.SourcelessFileLoader object at 0x00000154ADA0BA90> # extension module '_decimal' loaded from 'D:\\code\\python\\ecard-app\\dist\\ecard\\_decimal.pyd' # extension module '_decimal' executed from 'D:\\code\\python\\ecard-app\\dist\\ecard\\_decimal.pyd' import '_decimal' # <_frozen_importlib_external.ExtensionFileLoader object at 0x00000154ADA0B4C0> import 'decimal' # <_frozen_importlib_external.SourcelessFileLoader object at 0x00000154ADA09210> # extension module 'cx_Oracle' loaded from 'D:\\code\\python\\ecard-app\\dist\\ecard\\cx_Oracle.cp310-win_amd64.pyd' # extension module 'cx_Oracle' executed from 'D:\\code\\python\\ecard-app\\dist\\ecard\\cx_Oracle.cp310-win_amd64.pyd' import 'cx_Oracle' # <_frozen_importlib_external.ExtensionFileLoader object at 0x00000154AD9AA5C0> # tkinter.messagebox not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\ecard\\tkinter\\messagebox.pyc' # tkinter.commondialog not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\ecard\\tkinter\\commondialog.pyc' import 'tkinter.commondialog' # <_frozen_importlib_external.SourcelessFileLoader object at 0x00000154ADA55CC0> import 'tkinter.messagebox' # <_frozen_importlib_external.SourcelessFileLoader object at 0x00000154ADA55930> os.environ["PATH"]: D:\apps\oracle\instantclient_19_8;C:\Users\Liu.D.H\AppData\Roaming\Composer\vendor\bin;C:\Program Files (x86)\VMware\VMware Workstation\bin\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Users\Liu.D.H\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Program Files\Git\cmd;C:\Program Files (x86)\NetSarang\Xshell 7\;C:\Program Files (x86)\NetSarang\Xftp 7\;C:\ProgramData\chocolatey\bin;C:\Users\Liu.D.H\.wasmer\bin;C:\Users\Liu.D.H\.wasmer\globals\wapm_packages\.bin;C:\Program Files\mvndaemon\mvnd-0.7.1-windows-amd64\bin;C:\msys64\usr\bin;C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin;C:\Library\Swift-development\bin;C:\Library\icu-67\usr\bin;C:\Program Files\MiKTeX\miktex\bin\x64\;D:\apps\微信web开发者工具\dll;C:\Program Files\Git LFS;C:\Program Files\LLVM\bin;C:\Users\Liu.D.H\scoop\shims;C:\Users\Liu.D.H/.local/bin;C:\Users\Liu.D.H\AppData\Roaming\npm;C:\Users\Liu.D.H\.cargo\bin;C:\Users\Liu.D.H\AppData\Local\Microsoft\WindowsApps;C:\Users\Liu.D.H\anaconda3;C:\Users\Liu.D.H\anaconda3\Library\mingw-w64\bin;C:\Users\Liu.D.H\anaconda3\Library\usr\bin;C:\Users\Liu.D.H\anaconda3\Library\bin;C:\Users\Liu.D.H\anaconda3\Scripts;C:\Users\Liu.D.H\.dotnet\tools;C:\Users\Liu.D.H\AppData\Local\Programs\Microsoft VS Code\bin;D:\android\android_sdk\tools;D:\android\android_sdk\tools\bin;D:\android\android_sdk\platform-tools;D:\android\android_sdk\cmdline-tools\latest\bin;D:\android\android_sdk\build-tools\29.0.3;D:\android\android_sdk\ndk-bundle;C:\Program Files\Java\jdk-17\bin;D:\apps\flutter\bin;D:\apps\flutter\bin\cache\dart-sdk\bin;D:\apps\apache-maven-3.8.4\bin;D:\apps\ffmpeg-5.0-full_build\bin;D:\apps\ImageMagick-7.1.0-portable-Q16-HDRI-x64;D:\apps;D:\apps\bin;C:\Program Files\Sublime Text;C:\Program Files\JetBrains\DataGrip 2021.3.1\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Users\Liu.D.H\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Scripts;C:\Program Files\CMake\bin;D:\apps\graphicsmagick-1.3.36-q16;D:\apps\WasmEdge-0.9.1-windows\bin;C:\tools\msys64;C:\Users\Liu.D.H\AppData\Local\Pub\Cache\bin;C:\Program Files\JetBrains\IntelliJ IDEA 2021.3.1\bin;D:\apps\binaryen-version_105-x86_64-windows\bin;D:\apps\oracle\instantclient_19_8; D:\apps\oracle\instantclient_19_8\oci.dll os.system("where oci.dll"): 0 conn.connect()... ODPI [27292] 2022-02-25 10:35:18.111: Context Parameters: ODPI [27292] 2022-02-25 10:35:18.113: Environment Variables: ODPI [27292] 2022-02-25 10:35:18.115: PATH => "D:\apps\oracle\instantclient_19_8;C:\Users\Liu.D.H\AppData\Roaming\Composer\vendor\bin;C:\Program Files (x86)\VMware\VMware Workstation\bin\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Users\Liu.D.H\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Program Files\Git\cmd;C:\Program Files (x86)\NetSarang\Xshell 7\;C:\Program Files (x86)\NetSarang\Xftp 7\;C:\ProgramData\chocolatey\bin;C:\Users\Liu.D.H\.wasmer\bin;C:\Users\Liu.D.H\.wasmer\globals\wapm_packages\.bin;C:\Program Files\mvndaemon\mvnd-0.7.1-windows-amd64\bin;C:\msys64\usr\bin;C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin;C:\Library\Swift-development\bin;C:\Library\icu-67\usr\bin;C:\Program Files\MiKTeX\miktex\bin\x64\;D:\apps\微信web开发者工具\dll;C:\Program Files\Git LFS;C:\Program Files\LLVM\bin;C:\Users\Liu.D.H\scoop\shims;C:\Users\Liu.D.H/.local/bin;C:\Users\Liu.D.H\AppData\Roaming\npm;C:\Users\Liu.D.H\.cargo\bin;C:\Users\Liu.D.H\AppData\Local\Microsoft\WindowsApps;C:\Users\Liu.D.H\anaconda3;C:\Users\Liu.D.H\anaconda3\Library\mingw-w64\bin;C:\Users\Liu.D.H\anaconda3\Library\usr\bin;C:\Users\Liu.D.H\anaconda3\Library\bin;C:\Users\Liu.D.H\anaconda3\Scripts;C:\Users\Liu.D.H\.dotnet\tools;C:\Users\Liu.D.H\AppData\Local\Programs\Microsoft VS Code\bin;D:\android\android_sdk\tools;D:\android\android_sdk\tools\bin;D:\android\android_sdk\platform-tools;D:\android\android_sdk\cmdline-tools\latest\bin;D:\android\android_sdk\build-tools\29.0.3;D:\android\android_sdk\ndk-bundle;C:\Program Files\Java\jdk-17\bin;D:\apps\flutter\bin;D:\apps\flutter\bin\cache\dart-sdk\bin;D:\apps\apache-maven-3.8.4\bin;D:\apps\ffmpeg-5.0-full_build\bin;D:\apps\ImageMagick-7.1.0-portable-Q16-HDRI-x64;D:\apps;D:\apps\bin;C:\Program Files\Sublime Text;C:\Program Files\JetBrains\DataGrip 2021.3.1\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Users\Liu.D.H\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Scripts;C:\Program Files\CMake\bin;D:\apps\graphicsmagick-1.3.36-q16;D:\apps\WasmEdge-0.9.1-windows\bin;C:\tools\msys64;C:\Users\Liu.D.H\AppData\Local\Pub\Cache\bin;C:\Program Files\JetBrains\IntelliJ IDEA 2021.3.1\bin;D:\apps\binaryen-version_105-x86_64-windows\bin;D:\apps\oracle\instantclient_19_8;" ODPI [27292] 2022-02-25 10:35:18.190: check module directory ODPI [27292] 2022-02-25 10:35:18.192: module name is D:\code\python\ecard-app\dist\ecard\cx_Oracle.cp310-win_amd64.pyd ODPI [27292] 2022-02-25 10:35:18.195: load in dir D:\code\python\ecard-app\dist\ecard ODPI [27292] 2022-02-25 10:35:18.198: load with name D:\code\python\ecard-app\dist\ecard/oci.dll ODPI [27292] 2022-02-25 10:35:18.201: load by OS failure: The specified module could not be found ODPI [27292] 2022-02-25 10:35:18.204: load with OS search heuristics ODPI [27292] 2022-02-25 10:35:18.206: load with name oci.dll ODPI [27292] 2022-02-25 10:35:18.280: load by OS successful ODPI [27292] 2022-02-25 10:35:18.283: validating loaded library 数据库连接失败,请检查网络或联系开发人员 ORA-12170: TNS:Connect timeout occurred # traceback not found in PYZ import 'traceback' # Exception in Tkinter callback Traceback (most recent call last): File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.752.0_x64__qbz5n2kfra8p0\lib\tkinter\__init__.py", line 1921, in __call__ return self.func(*args) File "ecard.py", line 189, in func data1 = ora1.get_data(sql1) File "ecard.py", line 39, in get_data self.cursor.execute(sql) AttributeError: 'ConnectToOracle' object has no attribute 'cursor' [24716] LOADER: OK. [24716] LOADER: Manually flushing stdout and stderr [24716] LOADER: Cleaning up Python interpreter. # clear builtins._ # clear sys.path # clear sys.argv # clear sys.ps1 # clear sys.ps2 # clear sys.last_type # clear sys.last_value # clear sys.last_traceback # clear sys.path_hooks # clear sys.path_importer_cache # clear sys.meta_path # clear sys.__interactivehook__ # restore sys.stdin # restore sys.stdout # restore sys.stderr # cleanup[2] removing sys # cleanup[2] removing builtins # cleanup[2] removing _frozen_importlib # cleanup[2] removing _imp # cleanup[2] removing _thread # cleanup[2] removing _warnings # cleanup[2] removing _weakref # cleanup[2] removing _io # cleanup[2] removing marshal # cleanup[2] removing nt # cleanup[2] removing winreg # cleanup[2] removing _frozen_importlib_external # cleanup[2] removing time # cleanup[2] removing zipimport # cleanup[2] removing _codecs # cleanup[2] removing codecs # cleanup[2] removing encodings.aliases # cleanup[2] removing encodings # cleanup[2] removing encodings.utf_8 # cleanup[2] removing _codecs_cn # cleanup[2] removing _multibytecodec # cleanup[2] removing encodings.gbk # cleanup[2] removing _signal # cleanup[2] removing _abc # cleanup[2] removing abc # cleanup[2] removing io # cleanup[2] removing __main__ # cleanup[2] removing struct # cleanup[2] removing _struct # cleanup[2] removing pyimod01_os_path # cleanup[2] removing pyimod02_archive # cleanup[2] removing zlib # cleanup[2] removing pyimod03_importers # cleanup[2] removing pyimod04_ctypes # cleanup[2] removing _stat # cleanup[2] removing stat # cleanup[2] removing _collections_abc # cleanup[2] removing genericpath # cleanup[2] removing ntpath # cleanup[2] removing os.path # cleanup[2] removing os # cleanup[2] removing types # cleanup[2] removing _ctypes # cleanup[2] removing ctypes._endian # cleanup[2] removing ctypes # destroy ctypes # cleanup[2] removing _ast # destroy _ast # cleanup[2] removing itertools # cleanup[2] removing keyword # destroy keyword # cleanup[2] removing _operator # cleanup[2] removing operator # destroy operator # cleanup[2] removing reprlib # destroy reprlib # cleanup[2] removing _collections # cleanup[2] removing collections # cleanup[2] removing _functools # cleanup[2] removing functools # cleanup[2] removing contextlib # cleanup[2] removing enum # cleanup[2] removing ast # cleanup[2] removing _opcode # cleanup[2] removing opcode # destroy opcode # cleanup[2] removing dis # cleanup[2] removing collections.abc # cleanup[2] removing importlib._bootstrap # cleanup[2] removing importlib._bootstrap_external # cleanup[2] removing warnings # cleanup[2] removing importlib # cleanup[2] removing importlib.machinery # cleanup[2] removing _sre # cleanup[2] removing sre_constants # destroy sre_constants # cleanup[2] removing sre_parse # cleanup[2] removing sre_compile # cleanup[2] removing _locale # cleanup[2] removing copyreg # cleanup[2] removing re # cleanup[2] removing token # cleanup[2] removing tokenize # cleanup[2] removing linecache # cleanup[2] removing inspect # cleanup[2] removing errno # cleanup[2] removing signal # cleanup[2] removing _weakrefset # destroy _weakrefset # cleanup[2] removing threading # cleanup[2] removing msvcrt # cleanup[2] removing _winapi # cleanup[2] removing subprocess # cleanup[2] removing importlib._abc # cleanup[2] removing importlib.util # cleanup[2] removing weakref # cleanup[2] removing pkgutil # cleanup[2] removing multiprocessing.process # cleanup[2] removing _compat_pickle # cleanup[2] removing _pickle # cleanup[2] removing pickle # cleanup[2] removing _socket # cleanup[2] removing math # cleanup[2] removing select # cleanup[2] removing selectors # cleanup[2] removing socket # cleanup[2] removing multiprocessing.reduction # cleanup[2] removing multiprocessing.context # cleanup[2] removing __mp_main__ # destroy __main__ # cleanup[2] removing multiprocessing # cleanup[2] removing runpy # cleanup[2] removing atexit # cleanup[2] removing multiprocessing.util # cleanup[2] removing multiprocessing.spawn # cleanup[2] removing multiprocessing.popen_spawn_win32 # cleanup[2] removing _tkinter # cleanup[2] removing tkinter.constants # cleanup[2] removing tkinter # destroy tkinter # cleanup[2] removing _datetime # cleanup[2] removing datetime # destroy datetime # cleanup[2] removing numbers # destroy numbers # cleanup[2] removing _decimal # cleanup[2] removing decimal # destroy decimal # cleanup[2] removing cx_Oracle # cleanup[2] removing tkinter.commondialog # cleanup[2] removing tkinter.messagebox # cleanup[2] removing traceback # destroy traceback # destroy encodings # destroy inspect # destroy subprocess # destroy pkgutil # destroy multiprocessing # destroy multiprocessing.popen_spawn_win32 # destroy ast # destroy dis # destroy token # destroy _opcode # destroy importlib.machinery # destroy importlib._abc # destroy importlib.util # destroy tokenize # destroy contextlib # destroy _signal # destroy zipimport # destroy warnings # destroy collections # destroy linecache # destroy pickle # destroy socket # destroy multiprocessing.context # destroy _compat_pickle # destroy selectors # destroy errno # destroy math # destroy select # destroy runpy # destroy importlib # destroy io # destroy itertools # destroy weakref # destroy threading # destroy multiprocessing.process # destroy atexit # destroy signal # destroy _winapi # destroy multiprocessing.reduction # destroy multiprocessing.spawn # destroy multiprocessing.util # destroy tkinter.constants # destroy re # destroy tkinter.commondialog # destroy tkinter.messagebox # cleanup[3] wiping cx_Oracle # cleanup[3] wiping _decimal # cleanup[3] wiping _datetime # cleanup[3] wiping _tkinter # cleanup[3] wiping _socket # cleanup[3] wiping _pickle # cleanup[3] wiping msvcrt # cleanup[3] wiping copyreg # cleanup[3] wiping _locale # cleanup[3] wiping sre_compile # cleanup[3] wiping sre_parse # cleanup[3] wiping _sre # cleanup[3] wiping importlib._bootstrap_external # cleanup[3] wiping importlib._bootstrap # cleanup[3] wiping collections.abc # cleanup[3] wiping enum # cleanup[3] wiping functools # cleanup[3] wiping _functools # cleanup[3] wiping _collections # cleanup[3] wiping _operator # cleanup[3] wiping ctypes._endian # cleanup[3] wiping _ctypes # cleanup[3] wiping types # cleanup[3] wiping os # destroy ntpath # cleanup[3] wiping genericpath # cleanup[3] wiping _collections_abc # cleanup[3] wiping stat # cleanup[3] wiping _stat # destroy _stat # cleanup[3] wiping pyimod04_ctypes # cleanup[3] wiping pyimod03_importers # cleanup[3] wiping zlib # cleanup[3] wiping pyimod02_archive # cleanup[3] wiping pyimod01_os_path # cleanup[3] wiping _struct # cleanup[3] wiping struct # cleanup[3] wiping abc # cleanup[3] wiping _abc # cleanup[3] wiping encodings.gbk # cleanup[3] wiping _multibytecodec # cleanup[3] wiping _codecs_cn # destroy _codecs_cn # cleanup[3] wiping encodings.utf_8 # cleanup[3] wiping encodings.aliases # cleanup[3] wiping codecs # cleanup[3] wiping _codecs # cleanup[3] wiping time # cleanup[3] wiping _frozen_importlib_external # cleanup[3] wiping winreg # cleanup[3] wiping nt # cleanup[3] wiping marshal # cleanup[3] wiping _io # cleanup[3] wiping _weakref # cleanup[3] wiping _warnings # cleanup[3] wiping _thread # cleanup[3] wiping _imp # cleanup[3] wiping _frozen_importlib # cleanup[3] wiping sys # cleanup[3] wiping builtins # destroy cx_Oracle # destroy decimal # destroy _datetime # destroy _tkinter # destroy _socket # destroy _pickle # destroy msvcrt # destroy winreg # destroy zlib # destroy enum # destroy sre_compile # destroy sre_parse # destroy functools # destroy _locale # destroy copyreg # destroy _sre # destroy _functools # destroy stat # destroy genericpath # destroy nt # destroy codecs # destroy encodings.aliases # destroy encodings.utf_8 # destroy encodings.gbk # destroy _codecs # destroy _multibytecodec # destroy abc # clear sys.audit hooks D:\code\python\ecard-app> ```

However, from the code in https://github.com/oracle/odpi/blob/f73a7c13d643b3fe252614bafc930afbd8e287dd/src/dpiOci.c#L1733-L1755, the order in the PATH do not matters.

cjbj commented 2 years ago

The order in PATH would matter if you have other oci.dll's on your machine. Did you check how many are installed.

Keep experimenting. Your problem doesn't reproduce for us!

liudonghua123 commented 2 years ago

I tested with the query.py in https://cx-oracle.readthedocs.io/en/latest/user_guide/introduction.html#getting-started. And it was the same error info. I have one and only one oci.dll which is D:\apps\oracle\instantclient_19_8 in PATH, you could see the output of where oci.dll in the logs.

The problem is why exe worked while python script.py did not! It is really strange. I read the code in odpi, but could not find some clues until now. Maybe I can add some print code to see what's happened into odpi.

D:\code\python\ecard-app>cat query.py
# query.py

import os
def check_env():
    print(f'os.environ["PATH"]: {os.environ["PATH"]}')
    print(f'os.system("where oci.dll"): {os.system("where oci.dll")}')

check_env()

import cx_Oracle

# Establish the database connection
connection = cx_Oracle.connect(user="hr", password="userpwd",
                               dsn="dbhost.example.com/orclpdb1")

# Obtain a cursor
cursor = connection.cursor()

# Data for binding
manager_id = 145
first_name = "Peter"

# Execute the query
sql = """SELECT first_name, last_name
         FROM employees
         WHERE manager_id = :mid AND first_name = :fn"""
cursor.execute(sql, mid=manager_id, fn=first_name)

# Loop over the result set
for row in cursor:
    print(row)
D:\code\python\ecard-app>
The full logs ```shell D:\code\python\ecard-app>python query.py os.environ["PATH"]: D:\apps\oracle\instantclient_19_8;C:\Users\Liu.D.H\AppData\Roaming\Composer\vendor\bin;C:\Program Files (x86)\VMware\VMware Workstation\bin\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Users\Liu.D.H\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Program Files\Git\cmd;C:\Program Files (x86)\NetSarang\Xshell 7\;C:\Program Files (x86)\NetSarang\Xftp 7\;C:\ProgramData\chocolatey\bin;C:\Users\Liu.D.H\.wasmer\bin;C:\Users\Liu.D.H\.wasmer\globals\wapm_packages\.bin;C:\Program Files\mvndaemon\mvnd-0.7.1-windows-amd64\bin;C:\msys64\usr\bin;C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin;C:\Library\Swift-development\bin;C:\Library\icu-67\usr\bin;C:\Program Files\MiKTeX\miktex\bin\x64\;D:\apps\微信web开发者工具\dll;C:\Program Files\Git LFS;C:\Program Files\LLVM\bin;C:\Users\Liu.D.H\scoop\shims;C:\Users\Liu.D.H/.local/bin;C:\Users\Liu.D.H\AppData\Roaming\npm;C:\Users\Liu.D.H\.cargo\bin;C:\Users\Liu.D.H\AppData\Local\Microsoft\WindowsApps;C:\Users\Liu.D.H\anaconda3;C:\Users\Liu.D.H\anaconda3\Library\mingw-w64\bin;C:\Users\Liu.D.H\anaconda3\Library\usr\bin;C:\Users\Liu.D.H\anaconda3\Library\bin;C:\Users\Liu.D.H\anaconda3\Scripts;C:\Users\Liu.D.H\.dotnet\tools;C:\Users\Liu.D.H\AppData\Local\Programs\Microsoft VS Code\bin;D:\android\android_sdk\tools;D:\android\android_sdk\tools\bin;D:\android\android_sdk\platform-tools;D:\android\android_sdk\cmdline-tools\latest\bin;D:\android\android_sdk\build-tools\29.0.3;D:\android\android_sdk\ndk-bundle;C:\Program Files\Java\jdk-17\bin;D:\apps\flutter\bin;D:\apps\flutter\bin\cache\dart-sdk\bin;D:\apps\apache-maven-3.8.4\bin;D:\apps\ffmpeg-5.0-full_build\bin;D:\apps\ImageMagick-7.1.0-portable-Q16-HDRI-x64;D:\apps;D:\apps\bin;C:\Program Files\Sublime Text;C:\Program Files\JetBrains\DataGrip 2021.3.1\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Users\Liu.D.H\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Scripts;C:\Program Files\CMake\bin;D:\apps\graphicsmagick-1.3.36-q16;D:\apps\WasmEdge-0.9.1-windows\bin;C:\tools\msys64;C:\Users\Liu.D.H\AppData\Local\Pub\Cache\bin;C:\Program Files\JetBrains\IntelliJ IDEA 2021.3.1\bin;D:\apps\binaryen-version_105-x86_64-windows\bin;D:\apps\oracle\instantclient_19_8; D:\apps\oracle\instantclient_19_8\oci.dll os.system("where oci.dll"): 0 ODPI [25964] 2022-02-25 13:22:37.419: ODPI-C 4.3.0 ODPI [25964] 2022-02-25 13:22:37.419: debugging messages initialized at level 64 ODPI [25964] 2022-02-25 13:22:37.429: Context Parameters: ODPI [25964] 2022-02-25 13:22:37.429: Environment Variables: ODPI [25964] 2022-02-25 13:22:37.429: PATH => "D:\apps\oracle\instantclient_19_8;C:\Users\Liu.D.H\AppData\Roaming\Composer\vendor\bin;C:\Program Files (x86)\VMware\VMware Workstation\bin\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Users\Liu.D.H\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Program Files\Git\cmd;C:\Program Files (x86)\NetSarang\Xshell 7\;C:\Program Files (x86)\NetSarang\Xftp 7\;C:\ProgramData\chocolatey\bin;C:\Users\Liu.D.H\.wasmer\bin;C:\Users\Liu.D.H\.wasmer\globals\wapm_packages\.bin;C:\Program Files\mvndaemon\mvnd-0.7.1-windows-amd64\bin;C:\msys64\usr\bin;C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin;C:\Library\Swift-development\bin;C:\Library\icu-67\usr\bin;C:\Program Files\MiKTeX\miktex\bin\x64\;D:\apps\微信web开发者工具\dll;C:\Program Files\Git LFS;C:\Program Files\LLVM\bin;C:\Users\Liu.D.H\scoop\shims;C:\Users\Liu.D.H/.local/bin;C:\Users\Liu.D.H\AppData\Roaming\npm;C:\Users\Liu.D.H\.cargo\bin;C:\Users\Liu.D.H\AppData\Local\Microsoft\WindowsApps;C:\Users\Liu.D.H\anaconda3;C:\Users\Liu.D.H\anaconda3\Library\mingw-w64\bin;C:\Users\Liu.D.H\anaconda3\Library\usr\bin;C:\Users\Liu.D.H\anaconda3\Library\bin;C:\Users\Liu.D.H\anaconda3\Scripts;C:\Users\Liu.D.H\.dotnet\tools;C:\Users\Liu.D.H\AppData\Local\Programs\Microsoft VS Code\bin;D:\android\android_sdk\tools;D:\android\android_sdk\tools\bin;D:\android\android_sdk\platform-tools;D:\android\android_sdk\cmdline-tools\latest\bin;D:\android\android_sdk\build-tools\29.0.3;D:\android\android_sdk\ndk-bundle;C:\Program Files\Java\jdk-17\bin;D:\apps\flutter\bin;D:\apps\flutter\bin\cache\dart-sdk\bin;D:\apps\apache-maven-3.8.4\bin;D:\apps\ffmpeg-5.0-full_build\bin;D:\apps\ImageMagick-7.1.0-portable-Q16-HDRI-x64;D:\apps;D:\apps\bin;C:\Program Files\Sublime Text;C:\Program Files\JetBrains\DataGrip 2021.3.1\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Users\Liu.D.H\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Scripts;C:\Program Files\CMake\bin;D:\apps\graphicsmagick-1.3.36-q16;D:\apps\WasmEdge-0.9.1-windows\bin;C:\tools\msys64;C:\Users\Liu.D.H\AppData\Local\Pub\Cache\bin;C:\Program Files\JetBrains\IntelliJ IDEA 2021.3.1\bin;D:\apps\binaryen-version_105-x86_64-windows\bin;D:\apps\oracle\instantclient_19_8;" ODPI [25964] 2022-02-25 13:22:37.429: check module directory ODPI [25964] 2022-02-25 13:22:37.430: module name is C:\Users\Liu.D.H\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\cx_Oracle.cp310-win_amd64.pyd ODPI [25964] 2022-02-25 13:22:37.430: load in dir C:\Users\Liu.D.H\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages ODPI [25964] 2022-02-25 13:22:37.430: load with name C:\Users\Liu.D.H\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages/oci.dll ODPI [25964] 2022-02-25 13:22:37.430: load by OS failure: The specified module could not be found ODPI [25964] 2022-02-25 13:22:37.430: load with OS search heuristics ODPI [25964] 2022-02-25 13:22:37.430: load with name oci.dll ODPI [25964] 2022-02-25 13:22:37.430: load by OS failure: The specified module could not be found Traceback (most recent call last): File "D:\code\python\ecard-app\query.py", line 13, in connection = cx_Oracle.connect(user="hr", password="userpwd", cx_Oracle.DatabaseError: DPI-1047: Cannot locate a 64-bit Oracle Client library: "The specified module could not be found". See https://cx-oracle.readthedocs.io/en/latest/user_guide/installation.html for help D:\code\python\ecard-app>pyinstaller -D -w -d all -c query.py 1184 INFO: PyInstaller: 4.9 1185 INFO: Python: 3.10.2 1526 INFO: Platform: Windows-10-10.0.22000-SP0 1527 INFO: wrote D:\code\python\ecard-app\query.spec 1538 INFO: UPX is not available. 1547 INFO: Extending PYTHONPATH with paths ['D:\\code\\python\\ecard-app'] 2131 INFO: checking Analysis 2132 INFO: Building Analysis because Analysis-00.toc is non existent 2132 INFO: Initializing module dependency graph... 2149 INFO: Caching module graph hooks... 2181 INFO: Analyzing base_library.zip ... 8909 INFO: Caching module dependency graph... 9067 INFO: running Analysis Analysis-00.toc 9124 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable required by C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.752.0_x64__qbz5n2kfra8p0\python.exe 9916 INFO: Analyzing D:\code\python\ecard-app\query.py 9919 INFO: Processing module hooks... 9919 INFO: Loading module hook 'hook-cx_Oracle.py' from 'C:\\Users\\Liu.D.H\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python310\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'... 9926 INFO: Loading module hook 'hook-difflib.py' from 'C:\\Users\\Liu.D.H\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python310\\site-packages\\PyInstaller\\hooks'... 9934 INFO: Loading module hook 'hook-encodings.py' from 'C:\\Users\\Liu.D.H\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python310\\site-packages\\PyInstaller\\hooks'... 10112 INFO: Loading module hook 'hook-heapq.py' from 'C:\\Users\\Liu.D.H\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python310\\site-packages\\PyInstaller\\hooks'... 10120 INFO: Loading module hook 'hook-multiprocessing.util.py' from 'C:\\Users\\Liu.D.H\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python310\\site-packages\\PyInstaller\\hooks'... 10128 INFO: Loading module hook 'hook-pickle.py' from 'C:\\Users\\Liu.D.H\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python310\\site-packages\\PyInstaller\\hooks'... 10136 INFO: Loading module hook 'hook-sysconfig.py' from 'C:\\Users\\Liu.D.H\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python310\\site-packages\\PyInstaller\\hooks'... 10143 INFO: Loading module hook 'hook-xml.py' from 'C:\\Users\\Liu.D.H\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python310\\site-packages\\PyInstaller\\hooks'... 10482 INFO: Looking for ctypes DLLs 10486 INFO: Analyzing run-time hooks ... 10489 INFO: Including run-time hook 'C:\\Users\\Liu.D.H\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python310\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_inspect.py' 10497 INFO: Including run-time hook 'C:\\Users\\Liu.D.H\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python310\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_subprocess.py' 10506 INFO: Including run-time hook 'C:\\Users\\Liu.D.H\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python310\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_pkgutil.py' 10517 INFO: Including run-time hook 'C:\\Users\\Liu.D.H\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python310\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_multiprocessing.py' 10532 INFO: Looking for dynamic libraries 10763 INFO: Looking for eggs 10763 INFO: Using Python library C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.752.0_x64__qbz5n2kfra8p0\python310.dll 10763 INFO: Found binding redirects: [] 12841 INFO: Warnings written to D:\code\python\ecard-app\build\query\warn-query.txt 12879 INFO: Graph cross-reference written to D:\code\python\ecard-app\build\query\xref-query.html 12919 INFO: checking PYZ 12919 INFO: Building PYZ because PYZ-00.toc is non existent 12919 INFO: Building PYZ (ZlibArchive) D:\code\python\ecard-app\build\query\PYZ-00.pyz 12920 INFO: Building PYZ (ZlibArchive) D:\code\python\ecard-app\build\query\PYZ-00.pyz completed successfully. 12930 INFO: checking PKG 12930 INFO: Building PKG because PKG-00.toc is non existent 12930 INFO: Building PKG (CArchive) query.pkg 13004 INFO: Building PKG (CArchive) query.pkg completed successfully. 13006 INFO: Bootloader C:\Users\Liu.D.H\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\PyInstaller\bootloader\Windows-64bit\run_d.exe 13007 INFO: checking EXE 13007 INFO: Building EXE because EXE-00.toc is non existent 13007 INFO: Building EXE from EXE-00.toc 13008 INFO: Copying bootloader EXE to D:\code\python\ecard-app\build\query\query.exe 14282 INFO: Copying icon to EXE 14282 INFO: Copying icons from ['C:\\Users\\Liu.D.H\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python310\\site-packages\\PyInstaller\\bootloader\\images\\icon-console.ico'] 15709 INFO: Writing RT_GROUP_ICON 0 resource with 104 bytes 15710 INFO: Writing RT_ICON 1 resource with 3752 bytes 15710 INFO: Writing RT_ICON 2 resource with 2216 bytes 15710 INFO: Writing RT_ICON 3 resource with 1384 bytes 15711 INFO: Writing RT_ICON 4 resource with 37019 bytes 15711 INFO: Writing RT_ICON 5 resource with 9640 bytes 15712 INFO: Writing RT_ICON 6 resource with 4264 bytes 15712 INFO: Writing RT_ICON 7 resource with 1128 bytes 15717 INFO: Copying 0 resources to EXE 15718 INFO: Emedding manifest in EXE 15720 INFO: Updating manifest in D:\code\python\ecard-app\build\query\query.exe 16684 INFO: Updating resource type 24 name 1 language 0 16689 INFO: Appending PKG archive to EXE 17925 INFO: Building EXE from EXE-00.toc completed successfully. 17928 INFO: checking COLLECT 17928 INFO: Building COLLECT because COLLECT-00.toc is non existent 17929 INFO: Building COLLECT COLLECT-00.toc 21623 INFO: Building COLLECT COLLECT-00.toc completed successfully. D:\code\python\ecard-app>dist\query\query.exe [22400] PyInstaller Bootloader 3.x [22400] LOADER: executable is D:\code\python\ecard-app\dist\query\query.exe [22400] LOADER: homepath is D:\code\python\ecard-app\dist\query [22400] LOADER: _MEIPASS2 is NULL [22400] LOADER: archivename is D:\code\python\ecard-app\dist\query\query.exe [22400] LOADER: Cookie found at offset 0x4D46C [22400] LOADER: No need to extract files to run; setting extractionpath to homepath [22400] LOADER: SetDllDirectory(D:\code\python\ecard-app\dist\query) [22400] LOADER: Already in the child - running user's code. [22400] LOADER: Python library: D:\code\python\ecard-app\dist\query\python310.dll [22400] LOADER: Loaded functions from Python library. [22400] LOADER: Manipulating environment (sys.path, sys.prefix) [22400] LOADER: sys.prefix is D:\code\python\ecard-app\dist\query [22400] LOADER: Pre-init sys.path is D:\code\python\ecard-app\dist\query\base_library.zip;D:\code\python\ecard-app\dist\query\lib-dynload;D:\code\python\ecard-app\dist\query [22400] LOADER: Setting runtime options [22400] LOADER: Runtime option: v [22400] LOADER: Initializing python import _frozen_importlib # frozen import _imp # builtin import '_thread' # import '_warnings' # import '_weakref' # import '_io' # import 'marshal' # import 'nt' # import 'winreg' # import '_frozen_importlib_external' # # installing zipimport hook import 'time' # import 'zipimport' # # installed zipimport hook # zipimport: found 147 names in 'D:\\code\\python\\ecard-app\\dist\\query\\base_library.zip' import '_codecs' # import 'codecs' # import 'encodings.aliases' # import 'encodings' # import 'encodings.utf_8' # import '_codecs_cn' # import '_multibytecodec' # import 'encodings.gbk' # import '_signal' # import '_abc' # import 'abc' # import 'io' # [22400] LOADER: Overriding Python's sys.path [22400] LOADER: Post-init sys.path is D:\code\python\ecard-app\dist\query\base_library.zip;D:\code\python\ecard-app\dist\query\lib-dynload;D:\code\python\ecard-app\dist\query [22400] LOADER: Setting sys.argv [22400] LOADER: setting sys._MEIPASS [22400] LOADER: importing modules from CArchive [22400] LOADER: extracted struct [22400] LOADER: running unmarshalled code object for struct... import '_struct' # [22400] LOADER: extracted pyimod01_os_path [22400] LOADER: running unmarshalled code object for pyimod01_os_path... [22400] LOADER: extracted pyimod02_archive [22400] LOADER: running unmarshalled code object for pyimod02_archive... import 'zlib' # [22400] LOADER: extracted pyimod03_importers [22400] LOADER: running unmarshalled code object for pyimod03_importers... [22400] LOADER: extracted pyimod04_ctypes [22400] LOADER: running unmarshalled code object for pyimod04_ctypes... [22400] LOADER: Installing PYZ archive with Python modules. [22400] LOADER: PYZ archive: PYZ-00.pyz [22400] LOADER: Running pyiboot01_bootstrap.py # PyInstaller: FrozenImporter(D:\code\python\ecard-app\dist\query\query.exe?315942) # os not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\query\\os.pyc' # stat not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\query\\stat.pyc' import '_stat' # import 'stat' # <_frozen_importlib_external.SourcelessFileLoader object at 0x0000023D6EB31720> # _collections_abc not found in PYZ import '_collections_abc' # # ntpath not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\query\\ntpath.pyc' # genericpath not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\query\\genericpath.pyc' import 'genericpath' # <_frozen_importlib_external.SourcelessFileLoader object at 0x0000023D6EB64B20> import 'ntpath' # <_frozen_importlib_external.SourcelessFileLoader object at 0x0000023D6EB31A80> import 'os' # <_frozen_importlib_external.SourcelessFileLoader object at 0x0000023D6EB30250> # ctypes not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\query\\ctypes\\__init__.pyc' # types not found in PYZ import 'types' # # _ctypes not found in PYZ # extension module '_ctypes' loaded from 'D:\\code\\python\\ecard-app\\dist\\query\\_ctypes.pyd' # extension module '_ctypes' executed from 'D:\\code\\python\\ecard-app\\dist\\query\\_ctypes.pyd' import '_ctypes' # <_frozen_importlib_external.ExtensionFileLoader object at 0x0000023D6EB66020> # ctypes._endian not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\query\\ctypes\\_endian.pyc' import 'ctypes._endian' # <_frozen_importlib_external.SourcelessFileLoader object at 0x0000023D6EB67010> import 'ctypes' # <_frozen_importlib_external.SourcelessFileLoader object at 0x0000023D6EB31450> [22400] LOADER: Running pyi_rth_inspect.py # inspect not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\query\\inspect.pyc' # ast not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\query\\ast.pyc' import '_ast' # # contextlib not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\query\\contextlib.pyc' # collections not found in PYZ import 'itertools' # # keyword not found in PYZ import 'keyword' # # operator not found in PYZ import '_operator' # import 'operator' # # reprlib not found in PYZ import 'reprlib' # import '_collections' # import 'collections' # # functools not found in PYZ import '_functools' # import 'functools' # import 'contextlib' # <_frozen_importlib_external.SourcelessFileLoader object at 0x0000023D706E95D0> # enum not found in PYZ import 'enum' # import 'ast' # <_frozen_importlib_external.SourcelessFileLoader object at 0x0000023D6EBB54E0> # dis not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\query\\dis.pyc' # opcode not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\query\\opcode.pyc' import '_opcode' # import 'opcode' # <_frozen_importlib_external.SourcelessFileLoader object at 0x0000023D7075E530> import 'dis' # <_frozen_importlib_external.SourcelessFileLoader object at 0x0000023D6EBB5C60> # collections.abc not found in PYZ import 'collections.abc' # # importlib not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\query\\importlib\\__init__.pyc' # warnings not found in PYZ import 'warnings' # import 'importlib' # <_frozen_importlib_external.SourcelessFileLoader object at 0x0000023D7075F400> # importlib.machinery not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\query\\importlib\\machinery.pyc' import 'importlib.machinery' # <_frozen_importlib_external.SourcelessFileLoader object at 0x0000023D7075EBF0> # linecache not found in PYZ # tokenize not found in PYZ # re not found in PYZ # sre_compile not found in PYZ import '_sre' # # sre_parse not found in PYZ # sre_constants not found in PYZ import 'sre_constants' # import 'sre_parse' # import 'sre_compile' # import '_locale' # # copyreg not found in PYZ import 'copyreg' # import 're' # # token not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\query\\token.pyc' import 'token' # <_frozen_importlib_external.SourcelessFileLoader object at 0x0000023D7079B400> import 'tokenize' # import 'linecache' # import 'inspect' # <_frozen_importlib_external.SourcelessFileLoader object at 0x0000023D6EB67250> [22400] LOADER: Running pyi_rth_subprocess.py # subprocess not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\query\\subprocess.pyc' import 'errno' # # signal not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\query\\signal.pyc' import 'signal' # <_frozen_importlib_external.SourcelessFileLoader object at 0x0000023D707CA9E0> # threading not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\query\\threading.pyc' # _weakrefset not found in PYZ import '_weakrefset' # import 'threading' # <_frozen_importlib_external.SourcelessFileLoader object at 0x0000023D707CACB0> # fcntl not found in PYZ import 'msvcrt' # import '_winapi' # import 'subprocess' # <_frozen_importlib_external.SourcelessFileLoader object at 0x0000023D707CA110> [22400] LOADER: Running pyi_rth_pkgutil.py # pkgutil not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\query\\pkgutil.pyc' # importlib.util not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\query\\importlib\\util.pyc' # importlib._abc not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\query\\importlib\\_abc.pyc' import 'importlib._abc' # <_frozen_importlib_external.SourcelessFileLoader object at 0x0000023D707FE020> import 'importlib.util' # <_frozen_importlib_external.SourcelessFileLoader object at 0x0000023D707FD810> # weakref not found in PYZ import 'weakref' # import 'pkgutil' # <_frozen_importlib_external.SourcelessFileLoader object at 0x0000023D707CA5F0> [22400] LOADER: Running pyi_rth_multiprocessing.py # multiprocessing not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\query\\multiprocessing\\__init__.pyc' # multiprocessing.context not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\query\\multiprocessing\\context.pyc' # multiprocessing.process not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\query\\multiprocessing\\process.pyc' import 'multiprocessing.process' # <_frozen_importlib_external.SourcelessFileLoader object at 0x0000023D70839030> # multiprocessing.reduction not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\query\\multiprocessing\\reduction.pyc' # pickle not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\query\\pickle.pyc' # _compat_pickle not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\query\\_compat_pickle.pyc' import '_compat_pickle' # <_frozen_importlib_external.SourcelessFileLoader object at 0x0000023D70874940> import '_pickle' # # org not found in PYZ import 'pickle' # <_frozen_importlib_external.SourcelessFileLoader object at 0x0000023D7083A410> # socket not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\query\\socket.pyc' # _socket not found in PYZ # extension module '_socket' loaded from 'D:\\code\\python\\ecard-app\\dist\\query\\_socket.pyd' # extension module '_socket' executed from 'D:\\code\\python\\ecard-app\\dist\\query\\_socket.pyd' import '_socket' # <_frozen_importlib_external.ExtensionFileLoader object at 0x0000023D70875540> # selectors not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\query\\selectors.pyc' import 'math' # # select not found in PYZ # extension module 'select' loaded from 'D:\\code\\python\\ecard-app\\dist\\query\\select.pyd' # extension module 'select' executed from 'D:\\code\\python\\ecard-app\\dist\\query\\select.pyd' import 'select' # <_frozen_importlib_external.ExtensionFileLoader object at 0x0000023D708760E0> import 'selectors' # <_frozen_importlib_external.SourcelessFileLoader object at 0x0000023D70875660> import 'socket' # <_frozen_importlib_external.SourcelessFileLoader object at 0x0000023D7083B310> import 'multiprocessing.reduction' # <_frozen_importlib_external.SourcelessFileLoader object at 0x0000023D70839AB0> import 'multiprocessing.context' # <_frozen_importlib_external.SourcelessFileLoader object at 0x0000023D707FFDF0> import 'multiprocessing' # <_frozen_importlib_external.SourcelessFileLoader object at 0x0000023D707FFAC0> # multiprocessing.spawn not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\query\\multiprocessing\\spawn.pyc' # runpy not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\query\\runpy.pyc' import 'runpy' # <_frozen_importlib_external.SourcelessFileLoader object at 0x0000023D70876F50> # multiprocessing.util not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\query\\multiprocessing\\util.pyc' import 'atexit' # import 'multiprocessing.util' # <_frozen_importlib_external.SourcelessFileLoader object at 0x0000023D70877370> import 'multiprocessing.spawn' # <_frozen_importlib_external.SourcelessFileLoader object at 0x0000023D707FFBB0> # multiprocessing.popen_spawn_win32 not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\query\\multiprocessing\\popen_spawn_win32.pyc' import 'multiprocessing.popen_spawn_win32' # <_frozen_importlib_external.SourcelessFileLoader object at 0x0000023D70877C70> [22400] LOADER: Running query.py os.environ["PATH"]: D:\apps\oracle\instantclient_19_8;C:\Users\Liu.D.H\AppData\Roaming\Composer\vendor\bin;C:\Program Files (x86)\VMware\VMware Workstation\bin\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Users\Liu.D.H\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Program Files\Git\cmd;C:\Program Files (x86)\NetSarang\Xshell 7\;C:\Program Files (x86)\NetSarang\Xftp 7\;C:\ProgramData\chocolatey\bin;C:\Users\Liu.D.H\.wasmer\bin;C:\Users\Liu.D.H\.wasmer\globals\wapm_packages\.bin;C:\Program Files\mvndaemon\mvnd-0.7.1-windows-amd64\bin;C:\msys64\usr\bin;C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin;C:\Library\Swift-development\bin;C:\Library\icu-67\usr\bin;C:\Program Files\MiKTeX\miktex\bin\x64\;D:\apps\微信web开发者工具\dll;C:\Program Files\Git LFS;C:\Program Files\LLVM\bin;C:\Users\Liu.D.H\scoop\shims;C:\Users\Liu.D.H/.local/bin;C:\Users\Liu.D.H\AppData\Roaming\npm;C:\Users\Liu.D.H\.cargo\bin;C:\Users\Liu.D.H\AppData\Local\Microsoft\WindowsApps;C:\Users\Liu.D.H\anaconda3;C:\Users\Liu.D.H\anaconda3\Library\mingw-w64\bin;C:\Users\Liu.D.H\anaconda3\Library\usr\bin;C:\Users\Liu.D.H\anaconda3\Library\bin;C:\Users\Liu.D.H\anaconda3\Scripts;C:\Users\Liu.D.H\.dotnet\tools;C:\Users\Liu.D.H\AppData\Local\Programs\Microsoft VS Code\bin;D:\android\android_sdk\tools;D:\android\android_sdk\tools\bin;D:\android\android_sdk\platform-tools;D:\android\android_sdk\cmdline-tools\latest\bin;D:\android\android_sdk\build-tools\29.0.3;D:\android\android_sdk\ndk-bundle;C:\Program Files\Java\jdk-17\bin;D:\apps\flutter\bin;D:\apps\flutter\bin\cache\dart-sdk\bin;D:\apps\apache-maven-3.8.4\bin;D:\apps\ffmpeg-5.0-full_build\bin;D:\apps\ImageMagick-7.1.0-portable-Q16-HDRI-x64;D:\apps;D:\apps\bin;C:\Program Files\Sublime Text;C:\Program Files\JetBrains\DataGrip 2021.3.1\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Users\Liu.D.H\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Scripts;C:\Program Files\CMake\bin;D:\apps\graphicsmagick-1.3.36-q16;D:\apps\WasmEdge-0.9.1-windows\bin;C:\tools\msys64;C:\Users\Liu.D.H\AppData\Local\Pub\Cache\bin;C:\Program Files\JetBrains\IntelliJ IDEA 2021.3.1\bin;D:\apps\binaryen-version_105-x86_64-windows\bin;D:\apps\oracle\instantclient_19_8; D:\apps\oracle\instantclient_19_8\oci.dll os.system("where oci.dll"): 0 # cx_Oracle not found in PYZ ODPI [21280] 2022-02-25 13:24:30.664: ODPI-C 4.3.0 ODPI [21280] 2022-02-25 13:24:30.666: debugging messages initialized at level 64 # datetime not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\query\\datetime.pyc' import '_datetime' # import 'datetime' # <_frozen_importlib_external.SourcelessFileLoader object at 0x0000023D70AC8130> # decimal not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\query\\decimal.pyc' # _decimal not found in PYZ # numbers not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\query\\numbers.pyc' import 'numbers' # <_frozen_importlib_external.SourcelessFileLoader object at 0x0000023D70ACAAD0> # extension module '_decimal' loaded from 'D:\\code\\python\\ecard-app\\dist\\query\\_decimal.pyd' # extension module '_decimal' executed from 'D:\\code\\python\\ecard-app\\dist\\query\\_decimal.pyd' import '_decimal' # <_frozen_importlib_external.ExtensionFileLoader object at 0x0000023D70ACA500> import 'decimal' # <_frozen_importlib_external.SourcelessFileLoader object at 0x0000023D70AC8250> # extension module 'cx_Oracle' loaded from 'D:\\code\\python\\ecard-app\\dist\\query\\cx_Oracle.cp310-win_amd64.pyd' # extension module 'cx_Oracle' executed from 'D:\\code\\python\\ecard-app\\dist\\query\\cx_Oracle.cp310-win_amd64.pyd' import 'cx_Oracle' # <_frozen_importlib_external.ExtensionFileLoader object at 0x0000023D70877F40> ODPI [21280] 2022-02-25 13:24:30.709: Context Parameters: ODPI [21280] 2022-02-25 13:24:30.711: Environment Variables: ODPI [21280] 2022-02-25 13:24:30.713: PATH => "D:\apps\oracle\instantclient_19_8;C:\Users\Liu.D.H\AppData\Roaming\Composer\vendor\bin;C:\Program Files (x86)\VMware\VMware Workstation\bin\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Users\Liu.D.H\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Program Files\Git\cmd;C:\Program Files (x86)\NetSarang\Xshell 7\;C:\Program Files (x86)\NetSarang\Xftp 7\;C:\ProgramData\chocolatey\bin;C:\Users\Liu.D.H\.wasmer\bin;C:\Users\Liu.D.H\.wasmer\globals\wapm_packages\.bin;C:\Program Files\mvndaemon\mvnd-0.7.1-windows-amd64\bin;C:\msys64\usr\bin;C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin;C:\Library\Swift-development\bin;C:\Library\icu-67\usr\bin;C:\Program Files\MiKTeX\miktex\bin\x64\;D:\apps\微信web开发者工具\dll;C:\Program Files\Git LFS;C:\Program Files\LLVM\bin;C:\Users\Liu.D.H\scoop\shims;C:\Users\Liu.D.H/.local/bin;C:\Users\Liu.D.H\AppData\Roaming\npm;C:\Users\Liu.D.H\.cargo\bin;C:\Users\Liu.D.H\AppData\Local\Microsoft\WindowsApps;C:\Users\Liu.D.H\anaconda3;C:\Users\Liu.D.H\anaconda3\Library\mingw-w64\bin;C:\Users\Liu.D.H\anaconda3\Library\usr\bin;C:\Users\Liu.D.H\anaconda3\Library\bin;C:\Users\Liu.D.H\anaconda3\Scripts;C:\Users\Liu.D.H\.dotnet\tools;C:\Users\Liu.D.H\AppData\Local\Programs\Microsoft VS Code\bin;D:\android\android_sdk\tools;D:\android\android_sdk\tools\bin;D:\android\android_sdk\platform-tools;D:\android\android_sdk\cmdline-tools\latest\bin;D:\android\android_sdk\build-tools\29.0.3;D:\android\android_sdk\ndk-bundle;C:\Program Files\Java\jdk-17\bin;D:\apps\flutter\bin;D:\apps\flutter\bin\cache\dart-sdk\bin;D:\apps\apache-maven-3.8.4\bin;D:\apps\ffmpeg-5.0-full_build\bin;D:\apps\ImageMagick-7.1.0-portable-Q16-HDRI-x64;D:\apps;D:\apps\bin;C:\Program Files\Sublime Text;C:\Program Files\JetBrains\DataGrip 2021.3.1\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Users\Liu.D.H\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Scripts;C:\Program Files\CMake\bin;D:\apps\graphicsmagick-1.3.36-q16;D:\apps\WasmEdge-0.9.1-windows\bin;C:\tools\msys64;C:\Users\Liu.D.H\AppData\Local\Pub\Cache\bin;C:\Program Files\JetBrains\IntelliJ IDEA 2021.3.1\bin;D:\apps\binaryen-version_105-x86_64-windows\bin;D:\apps\oracle\instantclient_19_8;" ODPI [21280] 2022-02-25 13:24:30.780: check module directory ODPI [21280] 2022-02-25 13:24:30.782: module name is D:\code\python\ecard-app\dist\query\cx_Oracle.cp310-win_amd64.pyd ODPI [21280] 2022-02-25 13:24:30.785: load in dir D:\code\python\ecard-app\dist\query ODPI [21280] 2022-02-25 13:24:30.788: load with name D:\code\python\ecard-app\dist\query/oci.dll ODPI [21280] 2022-02-25 13:24:30.790: load by OS failure: The specified module could not be found ODPI [21280] 2022-02-25 13:24:30.794: load with OS search heuristics ODPI [21280] 2022-02-25 13:24:30.796: load with name oci.dll ODPI [21280] 2022-02-25 13:24:30.798: load by OS successful ODPI [21280] 2022-02-25 13:24:30.800: validating loaded library Traceback (most recent call last): File "query.py", line 13, in connection = cx_Oracle.connect(user="hr", password="userpwd", cx_Oracle.DatabaseError: ORA-12154: TNS:could not resolve the connect identifier specified [22400] Failed to execute script 'query' due to unhandled exception! [22400] LOADER: OK. [22400] LOADER: Manually flushing stdout and stderr [22400] LOADER: Cleaning up Python interpreter. # clear builtins._ # clear sys.path # clear sys.argv # clear sys.ps1 # clear sys.ps2 # clear sys.last_type # clear sys.last_value # clear sys.last_traceback # clear sys.path_hooks # clear sys.path_importer_cache # clear sys.meta_path # clear sys.__interactivehook__ # restore sys.stdin # restore sys.stdout # restore sys.stderr # cleanup[2] removing sys # cleanup[2] removing builtins # cleanup[2] removing _frozen_importlib # cleanup[2] removing _imp # cleanup[2] removing _thread # cleanup[2] removing _warnings # cleanup[2] removing _weakref # cleanup[2] removing _io # cleanup[2] removing marshal # cleanup[2] removing nt # cleanup[2] removing winreg # cleanup[2] removing _frozen_importlib_external # cleanup[2] removing time # cleanup[2] removing zipimport # cleanup[2] removing _codecs # cleanup[2] removing codecs # cleanup[2] removing encodings.aliases # cleanup[2] removing encodings # cleanup[2] removing encodings.utf_8 # cleanup[2] removing _codecs_cn # cleanup[2] removing _multibytecodec # cleanup[2] removing encodings.gbk # cleanup[2] removing _signal # cleanup[2] removing _abc # cleanup[2] removing abc # cleanup[2] removing io # cleanup[2] removing __main__ # cleanup[2] removing struct # cleanup[2] removing _struct # cleanup[2] removing pyimod01_os_path # cleanup[2] removing pyimod02_archive # cleanup[2] removing zlib # cleanup[2] removing pyimod03_importers # cleanup[2] removing pyimod04_ctypes # cleanup[2] removing _stat # cleanup[2] removing stat # cleanup[2] removing _collections_abc # cleanup[2] removing genericpath # cleanup[2] removing ntpath # cleanup[2] removing os.path # cleanup[2] removing os # cleanup[2] removing types # cleanup[2] removing _ctypes # cleanup[2] removing ctypes._endian # cleanup[2] removing ctypes # destroy ctypes # cleanup[2] removing _ast # destroy _ast # cleanup[2] removing itertools # cleanup[2] removing keyword # destroy keyword # cleanup[2] removing _operator # cleanup[2] removing operator # destroy operator # cleanup[2] removing reprlib # destroy reprlib # cleanup[2] removing _collections # cleanup[2] removing collections # cleanup[2] removing _functools # cleanup[2] removing functools # cleanup[2] removing contextlib # cleanup[2] removing enum # cleanup[2] removing ast # cleanup[2] removing _opcode # cleanup[2] removing opcode # destroy opcode # cleanup[2] removing dis # cleanup[2] removing collections.abc # cleanup[2] removing importlib._bootstrap # cleanup[2] removing importlib._bootstrap_external # cleanup[2] removing warnings # cleanup[2] removing importlib # cleanup[2] removing importlib.machinery # cleanup[2] removing _sre # cleanup[2] removing sre_constants # destroy sre_constants # cleanup[2] removing sre_parse # cleanup[2] removing sre_compile # cleanup[2] removing _locale # cleanup[2] removing copyreg # cleanup[2] removing re # cleanup[2] removing token # cleanup[2] removing tokenize # cleanup[2] removing linecache # cleanup[2] removing inspect # cleanup[2] removing errno # cleanup[2] removing signal # cleanup[2] removing _weakrefset # destroy _weakrefset # cleanup[2] removing threading # cleanup[2] removing msvcrt # cleanup[2] removing _winapi # cleanup[2] removing subprocess # cleanup[2] removing importlib._abc # cleanup[2] removing importlib.util # cleanup[2] removing weakref # cleanup[2] removing pkgutil # cleanup[2] removing multiprocessing.process # cleanup[2] removing _compat_pickle # cleanup[2] removing _pickle # cleanup[2] removing pickle # cleanup[2] removing _socket # cleanup[2] removing math # cleanup[2] removing select # cleanup[2] removing selectors # cleanup[2] removing socket # cleanup[2] removing multiprocessing.reduction # cleanup[2] removing multiprocessing.context # cleanup[2] removing __mp_main__ # destroy __main__ # cleanup[2] removing multiprocessing # cleanup[2] removing runpy # cleanup[2] removing atexit # cleanup[2] removing multiprocessing.util # cleanup[2] removing multiprocessing.spawn # cleanup[2] removing multiprocessing.popen_spawn_win32 # cleanup[2] removing _datetime # cleanup[2] removing datetime # destroy datetime # cleanup[2] removing numbers # destroy numbers # cleanup[2] removing _decimal # cleanup[2] removing decimal # destroy decimal # cleanup[2] removing cx_Oracle # destroy encodings # destroy inspect # destroy subprocess # destroy pkgutil # destroy multiprocessing # destroy multiprocessing.popen_spawn_win32 # destroy ast # destroy dis # destroy linecache # destroy token # destroy _opcode # destroy importlib.machinery # destroy importlib._abc # destroy importlib.util # destroy tokenize # destroy collections # destroy contextlib # destroy _signal # destroy zipimport # destroy warnings # destroy pickle # destroy socket # destroy multiprocessing.context # destroy re # destroy _compat_pickle # destroy selectors # destroy errno # destroy math # destroy select # destroy runpy # destroy importlib # destroy io # destroy itertools # destroy weakref # destroy threading # destroy multiprocessing.process # destroy atexit # destroy signal # destroy _winapi # destroy multiprocessing.reduction # destroy multiprocessing.spawn # destroy multiprocessing.util # cleanup[3] wiping cx_Oracle # cleanup[3] wiping _decimal # cleanup[3] wiping _datetime # cleanup[3] wiping _socket # cleanup[3] wiping _pickle # cleanup[3] wiping msvcrt # cleanup[3] wiping copyreg # cleanup[3] wiping _locale # cleanup[3] wiping sre_compile # cleanup[3] wiping sre_parse # cleanup[3] wiping _sre # cleanup[3] wiping importlib._bootstrap_external # cleanup[3] wiping importlib._bootstrap # cleanup[3] wiping collections.abc # cleanup[3] wiping enum # cleanup[3] wiping functools # cleanup[3] wiping _functools # cleanup[3] wiping _collections # cleanup[3] wiping _operator # cleanup[3] wiping ctypes._endian # cleanup[3] wiping _ctypes # cleanup[3] wiping types # cleanup[3] wiping os # destroy ntpath # cleanup[3] wiping genericpath # cleanup[3] wiping _collections_abc # cleanup[3] wiping stat # cleanup[3] wiping _stat # destroy _stat # cleanup[3] wiping pyimod04_ctypes # cleanup[3] wiping pyimod03_importers # cleanup[3] wiping zlib # cleanup[3] wiping pyimod02_archive # cleanup[3] wiping pyimod01_os_path # cleanup[3] wiping _struct # cleanup[3] wiping struct # cleanup[3] wiping abc # cleanup[3] wiping _abc # cleanup[3] wiping encodings.gbk # cleanup[3] wiping _multibytecodec # cleanup[3] wiping _codecs_cn # destroy _codecs_cn # cleanup[3] wiping encodings.utf_8 # cleanup[3] wiping encodings.aliases # cleanup[3] wiping codecs # cleanup[3] wiping _codecs # cleanup[3] wiping time # cleanup[3] wiping _frozen_importlib_external # cleanup[3] wiping winreg # cleanup[3] wiping nt # cleanup[3] wiping marshal # cleanup[3] wiping _io # cleanup[3] wiping _weakref # cleanup[3] wiping _warnings # cleanup[3] wiping _thread # cleanup[3] wiping _imp # cleanup[3] wiping _frozen_importlib # cleanup[3] wiping sys # cleanup[3] wiping builtins # destroy cx_Oracle # destroy decimal # destroy _datetime # destroy _socket # destroy _pickle # destroy msvcrt # destroy winreg # destroy zlib # destroy enum # destroy sre_compile # destroy sre_parse # destroy functools # destroy _locale # destroy copyreg # destroy _sre # destroy _functools # destroy stat # destroy genericpath # destroy nt # destroy codecs # destroy encodings.aliases # destroy encodings.utf_8 # destroy encodings.gbk # destroy _codecs # destroy _multibytecodec # destroy abc # clear sys.audit hooks D:\code\python\ecard-app> ```
liudonghua123 commented 2 years ago

I added some debugging info in https://github.com/oracle/odpi/blob/f73a7c13d643b3fe252614bafc930afbd8e287dd/src/dpiOci.c#L1768-L1788.

static int dpiOci__loadLibWithName(dpiOciLoadLibParams *loadParams,
        const char *name, dpiError *error)
{
    dpiDebug__print("dpiOci__loadLibWithName\n");
    DWORD errorNum;

    dpiDebug__print("dpiOci__loadLibWithName->name %s\n", name);
    // attempt to load the library
    loadParams->handle = LoadLibrary(name);
    if (loadParams->handle) {
        dpiDebug__print("dpiOci__loadLibWithName->LoadLibrary DPI_SUCCESS\n");
        return DPI_SUCCESS;
    }
    dpiDebug__print("dpiOci__loadLibWithName->LoadLibrary DPI_FAILURE\n");

    // if DLL is of the wrong architecture, attempt to locate the DLL that was
    // loaded and use that information if it can be found
    errorNum = GetLastError();
    dpiDebug__print("dpiOci__loadLibWithName->errorNum == ERROR_BAD_EXE_FORMAT: %d\n", errorNum == ERROR_BAD_EXE_FORMAT);
    if (errorNum == ERROR_BAD_EXE_FORMAT &&
            dpiOci__findAndCheckDllArchitecture(loadParams, name, error) == 0)
        return DPI_SUCCESS;

    // otherwise, attempt to get the error message
    return dpiUtils__getWindowsError(errorNum, &loadParams->errorBuffer,
            &loadParams->errorBufferLength, error);
}

And the console logs is the following.

D:\code\python\ecard-app>python query.py
......
ODPI [01012] 2022-02-25 14:19:26.676: load with OS search heuristics 123
ODPI [01012] 2022-02-25 14:19:26.676: load with name oci.dll
ODPI [01012] 2022-02-25 14:19:26.676: dpiOci__loadLibWithName
ODPI [01012] 2022-02-25 14:19:26.676: dpiOci__loadLibWithName->name oci.dll
ODPI [01012] 2022-02-25 14:19:26.676: dpiOci__loadLibWithName->LoadLibrary DPI_FAILURE
ODPI [01012] 2022-02-25 14:19:26.676: dpiOci__loadLibWithName->errorNum == ERROR_BAD_EXE_FORMAT: 0
ODPI [01012] 2022-02-25 14:19:26.676: load by OS failure: The specified module could not be found
......
D:\code\python\ecard-app>dist\query\query.exe
......
ODPI [28464] 2022-02-25 14:23:09.967: load with OS search heuristics 123
ODPI [28464] 2022-02-25 14:23:09.969: load with name oci.dll
ODPI [28464] 2022-02-25 14:23:09.971: dpiOci__loadLibWithName
ODPI [28464] 2022-02-25 14:23:09.973: dpiOci__loadLibWithName->name oci.dll
ODPI [28464] 2022-02-25 14:23:09.977: dpiOci__loadLibWithName->LoadLibrary DPI_SUCCESS
ODPI [28464] 2022-02-25 14:23:09.980: load by OS successful
ODPI [28464] 2022-02-25 14:23:09.981: validating loaded library
......

So the root issue is on loadParams->handle = LoadLibrary(name);! It worked in exe but not python script.py.

liudonghua123 commented 2 years ago

So I just tested LoadLibrary as the following code (mentioned in https://stackoverflow.com/questions/13265046/could-not-load-c-dll-in-python/13268880). This behavior is different in exe and python script.py!

from ctypes import cdll
cdll.LoadLibrary('oci.dll')
console logs ```shell D:\code\python\ecard-app>cat > load_oci.py from ctypes import cdll cdll.LoadLibrary('oci.dll') D:\code\python\ecard-app>python load_oci.py Traceback (most recent call last): File "D:\code\python\ecard-app\load_oci.py", line 2, in cdll.LoadLibrary('oci.dll') File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.752.0_x64__qbz5n2kfra8p0\lib\ctypes\__init__.py", line 452, in LoadLibrary return self._dlltype(name) File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.752.0_x64__qbz5n2kfra8p0\lib\ctypes\__init__.py", line 374, in __init__ self._handle = _dlopen(self._name, mode) FileNotFoundError: Could not find module 'oci.dll' (or one of its dependencies). Try using the full path with constructor syntax. D:\code\python\ecard-app>pyinstaller -D -w -d all -c load_oci.py 92 INFO: PyInstaller: 4.9 93 INFO: Python: 3.10.2 441 INFO: Platform: Windows-10-10.0.22000-SP0 442 INFO: wrote D:\code\python\ecard-app\load_oci.spec 447 INFO: UPX is not available. 454 INFO: Extending PYTHONPATH with paths ['D:\\code\\python\\ecard-app'] 834 INFO: checking Analysis 835 INFO: Building Analysis because Analysis-00.toc is non existent 835 INFO: Initializing module dependency graph... 839 INFO: Caching module graph hooks... 853 INFO: Analyzing base_library.zip ... 5608 INFO: Caching module dependency graph... 5789 INFO: running Analysis Analysis-00.toc 5807 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable required by C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.752.0_x64__qbz5n2kfra8p0\python.exe 6068 INFO: Analyzing D:\code\python\ecard-app\load_oci.py 6070 INFO: Processing module hooks... 6071 INFO: Loading module hook 'hook-difflib.py' from 'C:\\Users\\Liu.D.H\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python310\\site-packages\\PyInstaller\\hooks'... 6072 INFO: Loading module hook 'hook-encodings.py' from 'C:\\Users\\Liu.D.H\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python310\\site-packages\\PyInstaller\\hooks'... 6246 INFO: Loading module hook 'hook-heapq.py' from 'C:\\Users\\Liu.D.H\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python310\\site-packages\\PyInstaller\\hooks'... 6248 INFO: Loading module hook 'hook-multiprocessing.util.py' from 'C:\\Users\\Liu.D.H\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python310\\site-packages\\PyInstaller\\hooks'... 6249 INFO: Loading module hook 'hook-pickle.py' from 'C:\\Users\\Liu.D.H\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python310\\site-packages\\PyInstaller\\hooks'... 6250 INFO: Loading module hook 'hook-sysconfig.py' from 'C:\\Users\\Liu.D.H\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python310\\site-packages\\PyInstaller\\hooks'... 6251 INFO: Loading module hook 'hook-xml.py' from 'C:\\Users\\Liu.D.H\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python310\\site-packages\\PyInstaller\\hooks'... 6476 INFO: Looking for ctypes DLLs 6480 INFO: Analyzing run-time hooks ... 6483 INFO: Including run-time hook 'C:\\Users\\Liu.D.H\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python310\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_subprocess.py' 6484 INFO: Including run-time hook 'C:\\Users\\Liu.D.H\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python310\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_inspect.py' 6486 INFO: Including run-time hook 'C:\\Users\\Liu.D.H\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python310\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_pkgutil.py' 6490 INFO: Including run-time hook 'C:\\Users\\Liu.D.H\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python310\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_multiprocessing.py' 6497 INFO: Looking for dynamic libraries 6691 INFO: Looking for eggs 6691 INFO: Using Python library C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.752.0_x64__qbz5n2kfra8p0\python310.dll 6691 INFO: Found binding redirects: [] 8661 INFO: Warnings written to D:\code\python\ecard-app\build\load_oci\warn-load_oci.txt 8698 INFO: Graph cross-reference written to D:\code\python\ecard-app\build\load_oci\xref-load_oci.html 8710 INFO: checking PYZ 8710 INFO: Building PYZ because PYZ-00.toc is non existent 8710 INFO: Building PYZ (ZlibArchive) D:\code\python\ecard-app\build\load_oci\PYZ-00.pyz 8711 INFO: Building PYZ (ZlibArchive) D:\code\python\ecard-app\build\load_oci\PYZ-00.pyz completed successfully. 8723 INFO: checking PKG 8723 INFO: Building PKG because PKG-00.toc is non existent 8723 INFO: Building PKG (CArchive) load_oci.pkg 8738 INFO: Building PKG (CArchive) load_oci.pkg completed successfully. 8739 INFO: Bootloader C:\Users\Liu.D.H\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\PyInstaller\bootloader\Windows-64bit\run_d.exe 8739 INFO: checking EXE 8740 INFO: Building EXE because EXE-00.toc is non existent 8740 INFO: Building EXE from EXE-00.toc 8740 INFO: Copying bootloader EXE to D:\code\python\ecard-app\build\load_oci\load_oci.exe 8747 INFO: Copying icon to EXE 8747 INFO: Copying icons from ['C:\\Users\\Liu.D.H\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python310\\site-packages\\PyInstaller\\bootloader\\images\\icon-console.ico'] 8750 INFO: Writing RT_GROUP_ICON 0 resource with 104 bytes 8750 INFO: Writing RT_ICON 1 resource with 3752 bytes 8751 INFO: Writing RT_ICON 2 resource with 2216 bytes 8751 INFO: Writing RT_ICON 3 resource with 1384 bytes 8751 INFO: Writing RT_ICON 4 resource with 37019 bytes 8751 INFO: Writing RT_ICON 5 resource with 9640 bytes 8751 INFO: Writing RT_ICON 6 resource with 4264 bytes 8751 INFO: Writing RT_ICON 7 resource with 1128 bytes 8754 INFO: Copying 0 resources to EXE 8754 INFO: Emedding manifest in EXE 8755 INFO: Updating manifest in D:\code\python\ecard-app\build\load_oci\load_oci.exe 8758 INFO: Updating resource type 24 name 1 language 0 8760 INFO: Appending PKG archive to EXE 14171 INFO: Building EXE from EXE-00.toc completed successfully. 14174 INFO: checking COLLECT 14175 INFO: Building COLLECT because COLLECT-00.toc is non existent 14175 INFO: Building COLLECT COLLECT-00.toc 18034 INFO: Building COLLECT COLLECT-00.toc completed successfully. D:\code\python\ecard-app>python load_oci.py Traceback (most recent call last): File "D:\code\python\ecard-app\load_oci.py", line 2, in cdll.LoadLibrary('oci.dll') File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.752.0_x64__qbz5n2kfra8p0\lib\ctypes\__init__.py", line 452, in LoadLibrary return self._dlltype(name) File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.752.0_x64__qbz5n2kfra8p0\lib\ctypes\__init__.py", line 374, in __init__ self._handle = _dlopen(self._name, mode) FileNotFoundError: Could not find module 'oci.dll' (or one of its dependencies). Try using the full path with constructor syntax. D:\code\python\ecard-app>dist\load_oci\load_oci.exe [27664] PyInstaller Bootloader 3.x [27664] LOADER: executable is D:\code\python\ecard-app\dist\load_oci\load_oci.exe [27664] LOADER: homepath is D:\code\python\ecard-app\dist\load_oci [27664] LOADER: _MEIPASS2 is NULL [27664] LOADER: archivename is D:\code\python\ecard-app\dist\load_oci\load_oci.exe [27664] LOADER: Cookie found at offset 0x4D2EF [27664] LOADER: No need to extract files to run; setting extractionpath to homepath [27664] LOADER: SetDllDirectory(D:\code\python\ecard-app\dist\load_oci) [27664] LOADER: Already in the child - running user's code. [27664] LOADER: Python library: D:\code\python\ecard-app\dist\load_oci\python310.dll [27664] LOADER: Loaded functions from Python library. [27664] LOADER: Manipulating environment (sys.path, sys.prefix) [27664] LOADER: sys.prefix is D:\code\python\ecard-app\dist\load_oci [27664] LOADER: Pre-init sys.path is D:\code\python\ecard-app\dist\load_oci\base_library.zip;D:\code\python\ecard-app\dist\load_oci\lib-dynload;D:\code\python\ecard-app\dist\load_oci [27664] LOADER: Setting runtime options [27664] LOADER: Runtime option: v [27664] LOADER: Initializing python import _frozen_importlib # frozen import _imp # builtin import '_thread' # import '_warnings' # import '_weakref' # import '_io' # import 'marshal' # import 'nt' # import 'winreg' # import '_frozen_importlib_external' # # installing zipimport hook import 'time' # import 'zipimport' # # installed zipimport hook # zipimport: found 147 names in 'D:\\code\\python\\ecard-app\\dist\\load_oci\\base_library.zip' import '_codecs' # import 'codecs' # import 'encodings.aliases' # import 'encodings' # import 'encodings.utf_8' # import '_codecs_cn' # import '_multibytecodec' # import 'encodings.gbk' # import '_signal' # import '_abc' # import 'abc' # import 'io' # [27664] LOADER: Overriding Python's sys.path [27664] LOADER: Post-init sys.path is D:\code\python\ecard-app\dist\load_oci\base_library.zip;D:\code\python\ecard-app\dist\load_oci\lib-dynload;D:\code\python\ecard-app\dist\load_oci [27664] LOADER: Setting sys.argv [27664] LOADER: setting sys._MEIPASS [27664] LOADER: importing modules from CArchive [27664] LOADER: extracted struct [27664] LOADER: running unmarshalled code object for struct... import '_struct' # [27664] LOADER: extracted pyimod01_os_path [27664] LOADER: running unmarshalled code object for pyimod01_os_path... [27664] LOADER: extracted pyimod02_archive [27664] LOADER: running unmarshalled code object for pyimod02_archive... import 'zlib' # [27664] LOADER: extracted pyimod03_importers [27664] LOADER: running unmarshalled code object for pyimod03_importers... [27664] LOADER: extracted pyimod04_ctypes [27664] LOADER: running unmarshalled code object for pyimod04_ctypes... [27664] LOADER: Installing PYZ archive with Python modules. [27664] LOADER: PYZ archive: PYZ-00.pyz [27664] LOADER: Running pyiboot01_bootstrap.py # PyInstaller: FrozenImporter(D:\code\python\ecard-app\dist\load_oci\load_oci.exe?315561) # os not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\load_oci\\os.pyc' # stat not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\load_oci\\stat.pyc' import '_stat' # import 'stat' # <_frozen_importlib_external.SourcelessFileLoader object at 0x000001F29E915720> # _collections_abc not found in PYZ import '_collections_abc' # # ntpath not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\load_oci\\ntpath.pyc' # genericpath not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\load_oci\\genericpath.pyc' import 'genericpath' # <_frozen_importlib_external.SourcelessFileLoader object at 0x000001F29E944B20> import 'ntpath' # <_frozen_importlib_external.SourcelessFileLoader object at 0x000001F29E915A80> import 'os' # <_frozen_importlib_external.SourcelessFileLoader object at 0x000001F29E914250> # ctypes not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\load_oci\\ctypes\\__init__.pyc' # types not found in PYZ import 'types' # # _ctypes not found in PYZ # extension module '_ctypes' loaded from 'D:\\code\\python\\ecard-app\\dist\\load_oci\\_ctypes.pyd' # extension module '_ctypes' executed from 'D:\\code\\python\\ecard-app\\dist\\load_oci\\_ctypes.pyd' import '_ctypes' # <_frozen_importlib_external.ExtensionFileLoader object at 0x000001F29E946020> # ctypes._endian not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\load_oci\\ctypes\\_endian.pyc' import 'ctypes._endian' # <_frozen_importlib_external.SourcelessFileLoader object at 0x000001F29E947010> import 'ctypes' # <_frozen_importlib_external.SourcelessFileLoader object at 0x000001F29E915450> [27664] LOADER: Running pyi_rth_subprocess.py # subprocess not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\load_oci\\subprocess.pyc' import 'errno' # # signal not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\load_oci\\signal.pyc' # enum not found in PYZ import 'enum' # import 'signal' # <_frozen_importlib_external.SourcelessFileLoader object at 0x000001F29E947FA0> # threading not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\load_oci\\threading.pyc' # functools not found in PYZ # collections not found in PYZ import 'itertools' # # keyword not found in PYZ import 'keyword' # # operator not found in PYZ import '_operator' # import 'operator' # # reprlib not found in PYZ import 'reprlib' # import '_collections' # import 'collections' # import '_functools' # import 'functools' # # _weakrefset not found in PYZ import '_weakrefset' # import 'threading' # <_frozen_importlib_external.SourcelessFileLoader object at 0x000001F29E99C370> # warnings not found in PYZ import 'warnings' # # contextlib not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\load_oci\\contextlib.pyc' import 'contextlib' # <_frozen_importlib_external.SourcelessFileLoader object at 0x000001F2A04E5F30> # fcntl not found in PYZ import 'msvcrt' # import '_winapi' # import 'subprocess' # <_frozen_importlib_external.SourcelessFileLoader object at 0x000001F29E9472E0> [27664] LOADER: Running pyi_rth_inspect.py # inspect not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\load_oci\\inspect.pyc' # ast not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\load_oci\\ast.pyc' import '_ast' # import 'ast' # <_frozen_importlib_external.SourcelessFileLoader object at 0x000001F2A0535A80> # dis not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\load_oci\\dis.pyc' # opcode not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\load_oci\\opcode.pyc' import '_opcode' # import 'opcode' # <_frozen_importlib_external.SourcelessFileLoader object at 0x000001F2A0582980> import 'dis' # <_frozen_importlib_external.SourcelessFileLoader object at 0x000001F2A0536200> # collections.abc not found in PYZ import 'collections.abc' # # importlib not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\load_oci\\importlib\\__init__.pyc' import 'importlib' # <_frozen_importlib_external.SourcelessFileLoader object at 0x000001F2A0583850> # importlib.machinery not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\load_oci\\importlib\\machinery.pyc' import 'importlib.machinery' # <_frozen_importlib_external.SourcelessFileLoader object at 0x000001F2A0583670> # linecache not found in PYZ # tokenize not found in PYZ # re not found in PYZ # sre_compile not found in PYZ import '_sre' # # sre_parse not found in PYZ # sre_constants not found in PYZ import 'sre_constants' # import 'sre_parse' # import 'sre_compile' # import '_locale' # # copyreg not found in PYZ import 'copyreg' # import 're' # # token not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\load_oci\\token.pyc' import 'token' # <_frozen_importlib_external.SourcelessFileLoader object at 0x000001F2A05BF340> import 'tokenize' # import 'linecache' # import 'inspect' # <_frozen_importlib_external.SourcelessFileLoader object at 0x000001F29E947C70> [27664] LOADER: Running pyi_rth_pkgutil.py # pkgutil not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\load_oci\\pkgutil.pyc' # importlib.util not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\load_oci\\importlib\\util.pyc' # importlib._abc not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\load_oci\\importlib\\_abc.pyc' import 'importlib._abc' # <_frozen_importlib_external.SourcelessFileLoader object at 0x000001F2A05EE740> import 'importlib.util' # <_frozen_importlib_external.SourcelessFileLoader object at 0x000001F2A05EDB10> # weakref not found in PYZ import 'weakref' # import 'pkgutil' # <_frozen_importlib_external.SourcelessFileLoader object at 0x000001F2A0534400> [27664] LOADER: Running pyi_rth_multiprocessing.py # multiprocessing not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\load_oci\\multiprocessing\\__init__.pyc' # multiprocessing.context not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\load_oci\\multiprocessing\\context.pyc' # multiprocessing.process not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\load_oci\\multiprocessing\\process.pyc' import 'multiprocessing.process' # <_frozen_importlib_external.SourcelessFileLoader object at 0x000001F2A0619750> # multiprocessing.reduction not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\load_oci\\multiprocessing\\reduction.pyc' # pickle not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\load_oci\\pickle.pyc' # _compat_pickle not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\load_oci\\_compat_pickle.pyc' import '_compat_pickle' # <_frozen_importlib_external.SourcelessFileLoader object at 0x000001F2A0654940> import '_pickle' # # org not found in PYZ import 'pickle' # <_frozen_importlib_external.SourcelessFileLoader object at 0x000001F2A061A410> # socket not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\load_oci\\socket.pyc' # _socket not found in PYZ # extension module '_socket' loaded from 'D:\\code\\python\\ecard-app\\dist\\load_oci\\_socket.pyd' # extension module '_socket' executed from 'D:\\code\\python\\ecard-app\\dist\\load_oci\\_socket.pyd' import '_socket' # <_frozen_importlib_external.ExtensionFileLoader object at 0x000001F2A0655540> # selectors not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\load_oci\\selectors.pyc' import 'math' # # select not found in PYZ # extension module 'select' loaded from 'D:\\code\\python\\ecard-app\\dist\\load_oci\\select.pyd' # extension module 'select' executed from 'D:\\code\\python\\ecard-app\\dist\\load_oci\\select.pyd' import 'select' # <_frozen_importlib_external.ExtensionFileLoader object at 0x000001F2A06560E0> import 'selectors' # <_frozen_importlib_external.SourcelessFileLoader object at 0x000001F2A0655660> import 'socket' # <_frozen_importlib_external.SourcelessFileLoader object at 0x000001F2A061B310> import 'multiprocessing.reduction' # <_frozen_importlib_external.SourcelessFileLoader object at 0x000001F2A0619CF0> import 'multiprocessing.context' # <_frozen_importlib_external.SourcelessFileLoader object at 0x000001F2A0618550> import 'multiprocessing' # <_frozen_importlib_external.SourcelessFileLoader object at 0x000001F2A0618220> # multiprocessing.spawn not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\load_oci\\multiprocessing\\spawn.pyc' # runpy not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\load_oci\\runpy.pyc' import 'runpy' # <_frozen_importlib_external.SourcelessFileLoader object at 0x000001F2A0656F50> # multiprocessing.util not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\load_oci\\multiprocessing\\util.pyc' import 'atexit' # import 'multiprocessing.util' # <_frozen_importlib_external.SourcelessFileLoader object at 0x000001F2A0657370> import 'multiprocessing.spawn' # <_frozen_importlib_external.SourcelessFileLoader object at 0x000001F2A0618310> # multiprocessing.popen_spawn_win32 not found in PYZ # code object from 'D:\\code\\python\\ecard-app\\dist\\load_oci\\multiprocessing\\popen_spawn_win32.pyc' import 'multiprocessing.popen_spawn_win32' # <_frozen_importlib_external.SourcelessFileLoader object at 0x000001F2A0657C70> [27664] LOADER: Running load_oci.py [27664] LOADER: OK. [27664] LOADER: Manually flushing stdout and stderr [27664] LOADER: Cleaning up Python interpreter. # clear builtins._ # clear sys.path # clear sys.argv # clear sys.ps1 # clear sys.ps2 # clear sys.last_type # clear sys.last_value # clear sys.last_traceback # clear sys.path_hooks # clear sys.path_importer_cache # clear sys.meta_path # clear sys.__interactivehook__ # restore sys.stdin # restore sys.stdout # restore sys.stderr # cleanup[2] removing sys # cleanup[2] removing builtins # cleanup[2] removing _frozen_importlib # cleanup[2] removing _imp # cleanup[2] removing _thread # cleanup[2] removing _warnings # cleanup[2] removing _weakref # cleanup[2] removing _io # cleanup[2] removing marshal # cleanup[2] removing nt # cleanup[2] removing winreg # cleanup[2] removing _frozen_importlib_external # cleanup[2] removing time # cleanup[2] removing zipimport # cleanup[2] removing _codecs # cleanup[2] removing codecs # cleanup[2] removing encodings.aliases # cleanup[2] removing encodings # cleanup[2] removing encodings.utf_8 # cleanup[2] removing _codecs_cn # cleanup[2] removing _multibytecodec # cleanup[2] removing encodings.gbk # cleanup[2] removing _signal # cleanup[2] removing _abc # cleanup[2] removing abc # cleanup[2] removing io # cleanup[2] removing __main__ # cleanup[2] removing struct # cleanup[2] removing _struct # cleanup[2] removing pyimod01_os_path # cleanup[2] removing pyimod02_archive # cleanup[2] removing zlib # cleanup[2] removing pyimod03_importers # cleanup[2] removing pyimod04_ctypes # cleanup[2] removing _stat # cleanup[2] removing stat # cleanup[2] removing _collections_abc # cleanup[2] removing genericpath # cleanup[2] removing ntpath # cleanup[2] removing os.path # cleanup[2] removing os # cleanup[2] removing types # cleanup[2] removing _ctypes # cleanup[2] removing ctypes._endian # cleanup[2] removing ctypes # destroy ctypes # cleanup[2] removing errno # cleanup[2] removing enum # cleanup[2] removing signal # cleanup[2] removing itertools # cleanup[2] removing keyword # destroy keyword # cleanup[2] removing _operator # cleanup[2] removing operator # destroy operator # cleanup[2] removing reprlib # destroy reprlib # cleanup[2] removing _collections # cleanup[2] removing collections # cleanup[2] removing _functools # cleanup[2] removing functools # cleanup[2] removing _weakrefset # destroy _weakrefset # cleanup[2] removing threading # cleanup[2] removing warnings # cleanup[2] removing contextlib # cleanup[2] removing msvcrt # cleanup[2] removing _winapi # cleanup[2] removing subprocess # cleanup[2] removing _ast # destroy _ast # cleanup[2] removing ast # cleanup[2] removing _opcode # cleanup[2] removing opcode # destroy opcode # cleanup[2] removing dis # cleanup[2] removing collections.abc # cleanup[2] removing importlib._bootstrap # cleanup[2] removing importlib._bootstrap_external # cleanup[2] removing importlib # cleanup[2] removing importlib.machinery # cleanup[2] removing _sre # cleanup[2] removing sre_constants # destroy sre_constants # cleanup[2] removing sre_parse # cleanup[2] removing sre_compile # cleanup[2] removing _locale # cleanup[2] removing copyreg # cleanup[2] removing re # cleanup[2] removing token # cleanup[2] removing tokenize # cleanup[2] removing linecache # cleanup[2] removing inspect # cleanup[2] removing importlib._abc # cleanup[2] removing importlib.util # cleanup[2] removing weakref # cleanup[2] removing pkgutil # cleanup[2] removing multiprocessing.process # cleanup[2] removing _compat_pickle # cleanup[2] removing _pickle # cleanup[2] removing pickle # cleanup[2] removing _socket # cleanup[2] removing math # cleanup[2] removing select # cleanup[2] removing selectors # cleanup[2] removing socket # cleanup[2] removing multiprocessing.reduction # cleanup[2] removing multiprocessing.context # cleanup[2] removing __mp_main__ # destroy __main__ # cleanup[2] removing multiprocessing # cleanup[2] removing runpy # cleanup[2] removing atexit # cleanup[2] removing multiprocessing.util # cleanup[2] removing multiprocessing.spawn # cleanup[2] removing multiprocessing.popen_spawn_win32 # destroy encodings # destroy subprocess # destroy inspect # destroy pkgutil # destroy multiprocessing # destroy multiprocessing.popen_spawn_win32 # destroy contextlib # destroy _signal # destroy ast # destroy dis # destroy linecache # destroy token # destroy _opcode # destroy importlib.machinery # destroy importlib._abc # destroy importlib.util # destroy tokenize # destroy collections # destroy zipimport # destroy warnings # destroy runpy # destroy importlib # destroy itertools # destroy weakref # destroy threading # destroy multiprocessing.process # destroy atexit # destroy signal # destroy multiprocessing.reduction # destroy multiprocessing.spawn # destroy multiprocessing.util # destroy pickle # destroy socket # destroy multiprocessing.context # destroy _winapi # destroy re # destroy _compat_pickle # destroy io # destroy selectors # destroy errno # destroy math # destroy select # cleanup[3] wiping _socket # cleanup[3] wiping _pickle # cleanup[3] wiping copyreg # cleanup[3] wiping _locale # cleanup[3] wiping sre_compile # cleanup[3] wiping sre_parse # cleanup[3] wiping _sre # cleanup[3] wiping importlib._bootstrap_external # cleanup[3] wiping importlib._bootstrap # cleanup[3] wiping collections.abc # cleanup[3] wiping msvcrt # cleanup[3] wiping functools # cleanup[3] wiping _functools # cleanup[3] wiping _collections # cleanup[3] wiping _operator # cleanup[3] wiping enum # cleanup[3] wiping ctypes._endian # cleanup[3] wiping _ctypes # cleanup[3] wiping types # cleanup[3] wiping os # destroy ntpath # cleanup[3] wiping genericpath # cleanup[3] wiping _collections_abc # cleanup[3] wiping stat # cleanup[3] wiping _stat # destroy _stat # cleanup[3] wiping pyimod04_ctypes # cleanup[3] wiping pyimod03_importers # cleanup[3] wiping zlib # cleanup[3] wiping pyimod02_archive # cleanup[3] wiping pyimod01_os_path # cleanup[3] wiping _struct # cleanup[3] wiping struct # cleanup[3] wiping abc # cleanup[3] wiping _abc # cleanup[3] wiping encodings.gbk # cleanup[3] wiping _multibytecodec # cleanup[3] wiping _codecs_cn # destroy _codecs_cn # cleanup[3] wiping encodings.utf_8 # cleanup[3] wiping encodings.aliases # cleanup[3] wiping codecs # cleanup[3] wiping _codecs # cleanup[3] wiping time # cleanup[3] wiping _frozen_importlib_external # cleanup[3] wiping winreg # cleanup[3] wiping nt # cleanup[3] wiping marshal # cleanup[3] wiping _io # cleanup[3] wiping _weakref # cleanup[3] wiping _warnings # cleanup[3] wiping _thread # cleanup[3] wiping _imp # cleanup[3] wiping _frozen_importlib # cleanup[3] wiping sys # cleanup[3] wiping builtins # destroy _socket # destroy _pickle # destroy msvcrt # destroy winreg # destroy zlib # destroy enum # destroy sre_compile # destroy sre_parse # destroy functools # destroy _locale # destroy copyreg # destroy _sre # destroy _functools # destroy stat # destroy genericpath # destroy nt # destroy _weakref # destroy _collections # destroy collections.abc # destroy _thread # destroy _operator # destroy codecs # destroy encodings.aliases # destroy encodings.utf_8 # destroy encodings.gbk # destroy _codecs # destroy builtins # destroy _multibytecodec # destroy abc # destroy _collections_abc # destroy _abc # destroy _frozen_importlib_external # destroy _frozen_importlib # destroy _imp # destroy io # destroy marshal # destroy time # destroy _warnings # clear sys.audit hooks D:\code\python\ecard-app> ```

I also tested the follow code.

import traceback
import snoop

@snoop
def test_ctypes_loadlibrary():
    from ctypes import cdll
    print("ctypes.cdll.LoadLibrary")
    try:
        oci=cdll.LoadLibrary('oci.dll')
        print("ctypes.cdll.LoadLibrary", oci)
    except Exception as e:
        traceback.print_exc()

@snoop
def test_pywin32_loadlibrary():
    import win32api
    print("pywin32 win32api.LoadLibrary")
    try:
        oci=win32api.LoadLibrary('oci.dll')
        print("pywin32 win32api.LoadLibrary", oci)
    except Exception as e:
        traceback.print_exc()

test_ctypes_loadlibrary()
test_pywin32_loadlibrary()

The oci.dll could not load in python script.

cjbj commented 2 years ago

As a non Windows user, it's not clear to me whether win32 was/is only 32 bit.

Do you have 32-bit or 64-bit Oracle Instant Client.

liudonghua123 commented 2 years ago

@cjbj Hi, I have checked my envs again. Python, oracle instant client, the exe packaged via pyinstaller, all of them are 64-bit.

Microsoft Windows [Version 10.0.22000.527]
(c) Microsoft Corporation. All rights reserved.

Clink v1.2.42.d4506e
Copyright (c) 2012-2018 Martin Ridgers
Portions Copyright (c) 2020-2021 Christopher Antos
https://github.com/chrisant996/clink

C:\Users\Liu.D.H>where oci.dll
D:\apps\oracle\instantclient_19_8\oci.dll

C:\Users\Liu.D.H>linux_tools

C:\Users\Liu.D.H>file D:\apps\oracle\instantclient_19_8\oci.dll
D:\apps\oracle\instantclient_19_8\oci.dll: PE32+ executable (DLL) (GUI) x86-64, for MS Windows

C:\Users\Liu.D.H>d:

D:\>cd code\python\ecard-app\

D:\code\python\ecard-app>where python
C:\Users\Liu.D.H\AppData\Local\Microsoft\WindowsApps\python.exe
C:\Users\Liu.D.H\anaconda3\python.exe

D:\code\python\ecard-app>file C:\Users\Liu.D.H\AppData\Local\Microsoft\WindowsApps\python.exe
C:\Users\Liu.D.H\AppData\Local\Microsoft\WindowsApps\python.exe: symbolic link to /c/Program Files/WindowsApps/PythonSoftwareFoundation.Python.3.10_3.10.752.0_x64__qbz5n2kfra8p0/python3.10.exe

D:\code\python\ecard-app>file "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.752.0_x64__qbz5n2kfra8p0\python3.10.exe"
C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.752.0_x64__qbz5n2kfra8p0\python3.10.exe: PE32+ executable (console) x86-64, for MS Windows

D:\code\python\ecard-app>file dist\query\query.exe
dist\query\query.exe: PE32+ executable (console) x86-64, for MS Windows

D:\code\python\ecard-app>

And the dependences of oci.dll seems ok according to the comments mentioned in https://stackoverflow.com/questions/11717312/loadlibrary-project-dll-failed-the-specified-module-could-not-be-found.

image

The problem I interested is why python script.py not works while packaged_via_pyinstaller.exe works.

And I do not think it was a bad architecture error, because if this is the case, then loadParams->handle = LoadLibrary(name); would got ERROR_BAD_EXE_FORMAT and then dpiOci__findAndCheckDllArchitecture would invoked.

If I use python 3.10 32-bit to run the above load_oci.py test. I will get %1 is not a valid Win32 application error instead of The specified module could not be found.

D:\code\python\ecard-app>C:\Users\Liu.D.H\AppData\Local\Programs\Python\Python310-32\python.exe load_oci.py
09:46:17.78 >>> Call to test_ctypes_loadlibrary in File "D:\code\python\ecard-app\load_oci.py", line 5
09:46:17.78    5 | def test_ctypes_loadlibrary():
09:46:17.78    6 |      from ctypes import cdll
09:46:17.78 .......... cdll = <ctypes.LibraryLoader object at 0x01DC5E98>
09:46:17.78    7 |      print("ctypes.cdll.LoadLibrary")
ctypes.cdll.LoadLibrary
09:46:17.78    8 |      try:
09:46:17.78    9 |              oci=cdll.LoadLibrary('oci.dll')
09:46:17.80 !!! FileNotFoundError: Could not find module 'oci.dll' (or one of its dependencies). Try using the full path with constructor syntax.
09:46:17.80 !!! When calling: cdll.LoadLibrary('oci.dll')
09:46:17.80   11 |      except Exception as e:
09:46:17.80 .......... e = FileNotFoundError("Could not find module 'oci.dl...ry using the full path with constructor syntax.")
09:46:17.80   12 |              traceback.print_exc()
Traceback (most recent call last):
  File "D:\code\python\ecard-app\load_oci.py", line 9, in test_ctypes_loadlibrary
    oci=cdll.LoadLibrary('oci.dll')
  File "C:\Users\Liu.D.H\AppData\Local\Programs\Python\Python310-32\lib\ctypes\__init__.py", line 452, in LoadLibrary
    return self._dlltype(name)
  File "C:\Users\Liu.D.H\AppData\Local\Programs\Python\Python310-32\lib\ctypes\__init__.py", line 374, in __init__
    self._handle = _dlopen(self._name, mode)
FileNotFoundError: Could not find module 'oci.dll' (or one of its dependencies). Try using the full path with constructor syntax.
09:46:17.80 <<< Return value from test_ctypes_loadlibrary: None
09:46:17.80 >>> Call to test_pywin32_loadlibrary in File "D:\code\python\ecard-app\load_oci.py", line 15
09:46:17.80   15 | def test_pywin32_loadlibrary():
09:46:17.80   16 |      import win32api
09:46:17.81 .......... win32api = <module 'win32api' from 'C:\\Users\\Liu.D.H\\AppData\\Local\\Programs\\Python\\Python310-32\\lib\\site-packages\\win32\\win32api.cp310-win32.pyd'>
09:46:17.81   17 |      print("pywin32 win32api.LoadLibrary")
pywin32 win32api.LoadLibrary
09:46:17.81   18 |      try:
09:46:17.81   19 |              oci=win32api.LoadLibrary('oci.dll')
09:46:17.81 !!! pywintypes.error: (193, 'LoadLibrary', '%1 is not a valid Win32 application.')
09:46:17.81 !!! When calling: win32api.LoadLibrary('oci.dll')
09:46:17.81   21 |      except Exception as e:
09:46:17.81 .......... e = error(193, 'LoadLibrary', '%1 is not a valid Win32 application.')
09:46:17.81   22 |              traceback.print_exc()
Traceback (most recent call last):
  File "D:\code\python\ecard-app\load_oci.py", line 19, in test_pywin32_loadlibrary
    oci=win32api.LoadLibrary('oci.dll')
pywintypes.error: (193, 'LoadLibrary', '%1 is not a valid Win32 application.')
09:46:17.81 <<< Return value from test_pywin32_loadlibrary: None

D:\code\python\ecard-app>
cjbj commented 2 years ago

How are you going with this?

The fact that init_oracle_client() works for you, indicates to me there is something in your path or environment that is causing this.

liudonghua123 commented 2 years ago

I know I can use init_oracle_client to make it work, however, I just want to find why python script not work while pyinstaller_packaged_exe work using the PATH method in my current environment. It's really strange.

liudonghua123 commented 2 years ago

I tried the same code and tests on another computer without this error, and I reboot my computer and tested again without this error either.

Closing this issue due to can not reproduce.

@cjbj @sharadraju Thanks for your warmful helps.

If I encountered the same errors. Maybe I can use the following code to test and find "why".

// test_loadlibrary.cpp
// compile using vs2019 x64 prompt tools. cl test_loadlibrary.cpp
// running test_loadlibrary.exe

#include <windows.h>
#include <iostream>

int main() {
  HINSTANCE hOCIDLL = LoadLibrary("oci.dll");
  if (hOCIDLL == NULL) {
    std::cout << "Cannot LoadLibrary oci.dll" << std::endl;
    return -1;
  }
  std::cout << "LoadLibrary oci.dll successfully" << std::endl;
  return 0;
}
cjbj commented 2 years ago

@liudonghua123 thanks for sharing that code snippet. I'm glad the issue resolved itself.

cjbj commented 2 years ago

For anyone finding this issue via a search, try the latest cx_Oracle release (now called python-oracledb). It doesn't need Oracle Client libraries for most things. See https://oracle.github.io/python-oracledb/. Install with a command like python -m pip install oracledb