ModuleNotFoundError: No module named 'OpenSSL'

requirements.txt: requests==2.25.1 schedule==0.6.0 websocket-client==0.57.0 tk==0.1.0 disnake==2.8.1 YooMoney==0.1.0 pymysql==1.0.3 pyopenssl secrets python-dotenv aiohttp
43 Replies
Percy
Percy17mo ago
Project ID: fec9df58-fb4b-4b11-a70b-b435f14ba90a
Brody
Brody17mo ago
may i ask what you use pyopenssl for?
screamzus
screamzus17mo ago
fec9df58-fb4b-4b11-a70b-b435f14ba90a it is needed to use the Secrets module
Brody
Brody17mo ago
send me the table at the top of the build logs please
screamzus
screamzus17mo ago
Brody
Brody17mo ago
what python version are you using locally?
screamzus
screamzus17mo ago
3.10.5
Brody
Brody17mo ago
put 3.10 into a runtime.txt file to tell railway you want it to use 3.10.x let me know how that goes
screamzus
screamzus17mo ago
ok
screamzus
screamzus17mo ago
error )
Brody
Brody17mo ago
have you tried researching this error?
screamzus
screamzus17mo ago
Yes, but it didn't lead to anything. There are no explanations specifically on Railway hosting. There are explanations for installing locally, but everything works locally.
Brody
Brody17mo ago
this error wouldn't be specific to railway, i can recommend you look further into this, and if you need any help applying any solutions you find, ill be here 🙂
screamzus
screamzus17mo ago
The OpenSSL module itself is installed in python by default. But for some reason it is not on the hosting. )
Brody
Brody17mo ago
ill be here if you need any help applying the solutions you find!
screamzus
screamzus17mo ago
ok I found one answer, they say you will help) Unfortunately, access rights are restricted on the Railway platform and it is not possible to install system packages or change the Docker environment. In this situation, it is recommended to contact the Railway support service to clarify possible solutions to the problem or alternative ways to install the OpenSSL library on their platform. They may offer instructions or hints related to setting up the environment or available alternatives for installing the secrets module.
Brody
Brody17mo ago
okay link me to the solution and i will try my best to provide you a method to apply it to railway
screamzus
screamzus17mo ago
Thank you for your help. The problem was that it was necessary to remove the installation of the secrets library. The project has been successfully assembled
Brody
Brody17mo ago
well yeah but dont you need that package?
screamzus
screamzus17mo ago
there are 2 secrets modules, one is a pre-installed python module, and the second is a separate module that has nothing to do with the actions that I do in the program.
Brody
Brody17mo ago
oh well so problem solved?
screamzus
screamzus17mo ago
This problem has been solved, but a new one has appeared. I use such a database connection string. But with the correct data in it, I get an error connecting to the database. How can I fix it. As I understand it, I need to change the connection string so that it works on environments. But what values to insert there.
Brody
Brody17mo ago
it looks like you are forgetting to include the port in the connection string
screamzus
screamzus17mo ago
Should I specify it in the program code or in the connection string in the config file
Brody
Brody17mo ago
you really shouldn't be hard coding anything like that can you show me a screenshot of your railway service variables
screamzus
screamzus17mo ago
it contains only token variables from the .env file
Brody
Brody17mo ago
please setup the variable references for the database https://docs.railway.app/develop/variables#reference-variables show me a screenshot when done please
screamzus
screamzus17mo ago
As far as I understand it should look something like this
Brody
Brody17mo ago
is this a screenshot of a .env file?
Brody
Brody17mo ago
if so, delete that line please
screamzus
screamzus17mo ago
ok )
Brody
Brody17mo ago
okay now does it connect to the database?
screamzus
screamzus17mo ago
I need a couple of dozen minutes to fix the program code and try.
Brody
Brody17mo ago
alrighty no worries, let me know how it goes once you've deployed to railway and a little tip for you, please don't hardcode any credentials in code or a .env file, you can store all the credentials in railways services variables, and then use the railway cli with railway run <the command you normally use to start your app locally> this will pull the variables from the railway service and run the given command with the service variables available locally
screamzus
screamzus17mo ago
ok
Brody
Brody17mo ago
happy coding!
screamzus
screamzus17mo ago
I don't understand a bit why 2 arguments are passed to the method when one dependency is used with a link to connect
Brody
Brody17mo ago
can pymysql.connect() even accept a database URL? you may need to use all the variables for the database
Brody
Brody17mo ago
like how the example code does it, but of course using environment variables
screamzus
screamzus17mo ago
Thank you very much. Everything works correctly. You can close the topic👍
Brody
Brody17mo ago
and you are using environment variables and variable references in the railway service?
screamzus
screamzus17mo ago
Yes my friend
Brody
Brody17mo ago
awsome, glad we could solve this!
Want results from more Discord servers?
Add your server