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
Percy2y ago
Project ID: fec9df58-fb4b-4b11-a70b-b435f14ba90a
Brody
Brody2y ago
may i ask what you use pyopenssl for?
screamzus
screamzusOP2y ago
fec9df58-fb4b-4b11-a70b-b435f14ba90a it is needed to use the Secrets module
Brody
Brody2y ago
send me the table at the top of the build logs please
screamzus
screamzusOP2y ago
Brody
Brody2y ago
what python version are you using locally?
screamzus
screamzusOP2y ago
3.10.5
Brody
Brody2y 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
screamzusOP2y ago
ok
screamzus
screamzusOP2y ago
error )
Brody
Brody2y ago
have you tried researching this error?
screamzus
screamzusOP2y 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
Brody2y 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
screamzusOP2y ago
The OpenSSL module itself is installed in python by default. But for some reason it is not on the hosting. )
Brody
Brody2y ago
ill be here if you need any help applying the solutions you find!
screamzus
screamzusOP2y 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
Brody2y ago
okay link me to the solution and i will try my best to provide you a method to apply it to railway
screamzus
screamzusOP2y 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
Brody2y ago
well yeah but dont you need that package?
screamzus
screamzusOP2y 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
Brody2y ago
oh well so problem solved?
screamzus
screamzusOP2y 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
Brody2y ago
it looks like you are forgetting to include the port in the connection string
screamzus
screamzusOP2y ago
Should I specify it in the program code or in the connection string in the config file
Brody
Brody2y ago
you really shouldn't be hard coding anything like that can you show me a screenshot of your railway service variables
screamzus
screamzusOP2y ago
it contains only token variables from the .env file
Brody
Brody2y 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
screamzusOP2y ago
As far as I understand it should look something like this
Brody
Brody2y ago
is this a screenshot of a .env file?
Brody
Brody2y ago
if so, delete that line please
screamzus
screamzusOP2y ago
ok )
Brody
Brody2y ago
okay now does it connect to the database?
screamzus
screamzusOP2y ago
I need a couple of dozen minutes to fix the program code and try.
Brody
Brody2y 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
screamzusOP2y ago
ok
Brody
Brody2y ago
happy coding!
screamzus
screamzusOP2y 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
Brody2y ago
can pymysql.connect() even accept a database URL? you may need to use all the variables for the database
Brody
Brody2y ago
like how the example code does it, but of course using environment variables
screamzus
screamzusOP2y ago
Thank you very much. Everything works correctly. You can close the topic👍
Brody
Brody2y ago
and you are using environment variables and variable references in the railway service?
screamzus
screamzusOP2y ago
Yes my friend
Brody
Brody2y ago
awsome, glad we could solve this!
Want results from more Discord servers?
Add your server