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
Project ID:
fec9df58-fb4b-4b11-a70b-b435f14ba90a
may i ask what you use pyopenssl for?
fec9df58-fb4b-4b11-a70b-b435f14ba90a
it is needed to use the Secrets module
send me the table at the top of the build logs please
what python version are you using locally?
3.10.5
put
3.10
into a runtime.txt
file to tell railway you want it to use 3.10.x
let me know how that goesok
error )
have you tried researching this error?
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.
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 🙂
The OpenSSL module itself is installed in python by default. But for some reason it is not on the hosting. )
ill be here if you need any help applying the solutions you find!
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.
okay link me to the solution and i will try my best to provide you a method to apply it to railway
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
well yeah but dont you need that package?
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.
oh well so problem solved?
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.
it looks like you are forgetting to include the port in the connection string
Should I specify it in the program code or in the connection string in the config file
you really shouldn't be hard coding anything like that
can you show me a screenshot of your railway service variables
it contains only token variables from the .env file
please setup the variable references for the database
https://docs.railway.app/develop/variables#reference-variables
show me a screenshot when done please
As far as I understand it should look something like this
is this a screenshot of a .env file?
if so, delete that line please
ok )
okay now does it connect to the database?
I need a couple of dozen minutes to fix the program code and try.
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 locallyok
happy coding!
I don't understand a bit why 2 arguments are passed to the method when one dependency is used with a link to connect
can
pymysql.connect()
even accept a database URL? you may need to use all the variables for the databaselike how the example code does it, but of course using environment variables
Thank you very much. Everything works correctly. You can close the topic👍
and you are using environment variables and variable references in the railway service?
Yes my friend
awsome, glad we could solve this!