rigglemania / pysqlcipher3

Python 3 bindings for SQLCipher
zlib License
138 stars 42 forks source link

Cant use sqlcipher in github actions #28

Open AceScottie opened 2 years ago

AceScottie commented 2 years ago

This is working well on Windows however on github actions for python-applicatioin i get the following error when running pytest:

DataCore.py:18: in <module>
    from sqlcipher3 import dbapi2 as sqlcipher ## required for SQLite connection
sqlcipher3\__init__.py:[23](https://github.com/ChatterBugLtd/OEPR-Main/runs/7360105614?check_suite_focus=true#step:9:24): in <module>
    from sqlcipher3.dbapi2 import *
sqlcipher3\dbapi2.py:[28](https://github.com/ChatterBugLtd/OEPR-Main/runs/7360105614?check_suite_focus=true#step:9:29): in <module>
    from sqlcipher3._sqlite3 import *
E   ImportError: DLL load failed while importing _sqlite3: The specified module could not be found.

I have uploaded all the relevant files from the DLLs directory and from the sqlcipher3 folder

/- project_root
/- DataCore.py
/-- sqlcipher3
/--- __init__.py
/--- _sqlite3.cp39-win_amd64.pyd
/--- _sqlite3.py
/--- dbapi2.py

/-- DLLs
/--- _sqlite3.pyd
/--- _sqlite3.pdb
/--- _sqlite3_d.pyd
/--- _sqlite3_d.pdb
/--- sqlite3.dll
/--- sqlite3.pdb
/--- sqlite3_d.dll
/--- sqlite3_d.pdb

DLLs are copied in actions to the python DLLs directory:

...
runs-on: windows-latest
...
- name: Copy DLLs
  run: |
  copy D:\a\project\project\DLLs\* C:\hostedtoolcache\windows\Python\3.9.11\x64\DLLs\
  dir C:\hostedtoolcache\windows\Python\3.9.11\x64\DLLs\

and i have confirmed they are in there using the dir command.

...
-a---           7/15/2022  2:55 PM         3184 _sqlite3_d.pdb
-a---           7/15/2022  2:55 PM         150016 _sqlite3_d.pyd
-a---           7/15/2022  2:55 PM         684032 _sqlite3.pdb
-a---           7/15/2022  2:55 PM          90576 _sqlite3.pyd
...
-a---           7/15/2022  2:55 PM        1776128 sqlite3_d.dll
-a---           7/15/2022  2:55 PM        2781184 sqlite3_d.pdb
-a---           7/15/2022  2:55 PM        1549264 sqlite3.dll
-a---           7/15/2022  2:55 PM        5091328 sqlite3.pdb
...

I have not included pysqlcipher3 as part of requirements.txt as I figured having it in the root directory should work just as well?

Again this all works on my local machine and pytest completes successfully.