SQLAlchemy and PyMySQL

Please post any questions about developing your plugin here. Please use the search function before posting!
arawra
Senior Member
Posts: 190
Joined: Fri Jun 21, 2013 6:51 am

SQLAlchemy and PyMySQL

Postby arawra » Sat Sep 19, 2020 9:54 am

I am trying to use these to make connections and update a database. While I'm on the same network as my database, they work with no issue. But when they exist on different networks, PyMySQL tries to make use of the Cryptography package.

Normally I'd just `pip install cryptography` and be on my way. But seeing as how we don't have pip, I'm not so fortunate. On my local Windows machine, I can just take /sites-package/cryptography and drop it in addons/source-python/packages/site-packages/ and it works. However on a remote Windows server, I get this error:

Code: Select all

c_key(public_key, default_backend())
  File "..\addons\source-python\packages\site-packages\cryptography\hazmat\backends\__init__.py", line 15, in default_backend
    from cryptography.hazmat.backends.openssl.backend import backend
  File "..\addons\source-python\packages\site-packages\cryptography\hazmat\backends\openssl\__init__.py", line 7, in <module>
    from cryptography.hazmat.backends.openssl.backend import backend
  File "..\addons\source-python\packages\site-packages\cryptography\hazmat\backends\openssl\backend.py", line 117, in <module>
    from cryptography.hazmat.bindings.openssl import binding
  File "..\addons\source-python\packages\site-packages\cryptography\hazmat\bindings\openssl\binding.py", line 15, in <module>
    from cryptography.hazmat.bindings._openssl import ffi, lib

ImportError: DLL load failed: The specified module could not be found.


I'm not exactly sure why I can't reproduce this locally. However I'm all ears for another solution. I would have tried MySQL.connector but again, the pip issue.
Last edited by arawra on Sun Sep 20, 2020 2:55 am, edited 1 time in total.
User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Re: SQLAlchemy and PyMySQL

Postby L'In20Cible » Sun Sep 20, 2020 12:08 am

arawra wrote:I am trying to use these to make connections and update a database. While I'm on the same network as my database, they work with no issue. But when they exist on different networks, PyMySQL tries to make use of the Cryptography package.

Normally I'd just `pip install cryptography` and be on my way. But seeing as how we don't have pip, I'm not so fortunate. On my local Windows machine, I can just take /sites-package/cryptography and drop it in addons/source-python/site-packages/ and it works. However on a remote Windows server, I get this error:

Code: Select all

c_key(public_key, default_backend())
  File "..\addons\source-python\packages\site-packages\cryptography\hazmat\backends\__init__.py", line 15, in default_backend
    from cryptography.hazmat.backends.openssl.backend import backend
  File "..\addons\source-python\packages\site-packages\cryptography\hazmat\backends\openssl\__init__.py", line 7, in <module>
    from cryptography.hazmat.backends.openssl.backend import backend
  File "..\addons\source-python\packages\site-packages\cryptography\hazmat\backends\openssl\backend.py", line 117, in <module>
    from cryptography.hazmat.bindings.openssl import binding
  File "..\addons\source-python\packages\site-packages\cryptography\hazmat\bindings\openssl\binding.py", line 15, in <module>
    from cryptography.hazmat.bindings._openssl import ffi, lib

ImportError: DLL load failed: The specified module could not be found.


I'm not exactly sure why I can't reproduce this locally. However I'm all ears for another solution. I would have tried MySQL.connector but again, the pip issue.


My first guesses would be:

  • You copied a version over that is not compatible.
  • The cache you copied over is conflicting with the dynamic linkage.

Try to download a fresh build for Python 3.6.1 32 bits.
arawra
Senior Member
Posts: 190
Joined: Fri Jun 21, 2013 6:51 am

Re: SQLAlchemy and PyMySQL

Postby arawra » Sun Sep 20, 2020 12:39 am

So I have gotten the 3.6 builds for cryptography. I went so far as using pyenv to make sure I got a version for 3.6. I suppose I'll try it with the link you provided.
arawra
Senior Member
Posts: 190
Joined: Fri Jun 21, 2013 6:51 am

Re: SQLAlchemy and PyMySQL

Postby arawra » Sun Sep 20, 2020 3:23 am

The site provided was the same as I had been using. I tried the 3.0 version of cryptography and it gave a bit more descriptive of a traceback. Turns out I just needed the dependency package, cffi. Now I'm just troubleshooting crashes/lag and DB permissions.

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 9 guests