Project ID 1f1be0bd-99ea-43ca-9a89-d64b2fee9235
Service ID d0eedb87-96b1-402e-9953-e4e6b7820022
I'm trying to place my Python project on the railway.app server, which receives information from various crypto exchanges via websockets and saves it to the Database. After downloading the code from github, I get an error on railway.app
Traceback (most recent call last):
File "main.py", line 2, in <module>
import BD
File "/app/BD.py", line 1, in <module>
import mysql.connector
ModuleNotFoundError: No module named 'mysql'
Please, help me fix the error
26 Replies
Project ID:
d0eedb87-96b1-402e-9953-e4e6b7820022
do you have mysql in your requirements.txt?
no, I only added the Procfile.txt file with the following crab content to my code: python main_run.bot
Please tell me what other data needs to be added to the code. The code is written in python. It makes requests via websockets to various crypto exchanges, and saves the received information to the database
- the file needs to be just
Procfile
with a capital 'P' and no extension
- please watch this video https://www.youtube.com/watch?v=oLlT6c6jA-M
- your python file should have a '.py' extension not '.bot'did as recommended, got a new error related to the binance exchange. If I understand correctly, the exchange is blocked for work on your hosting?
yes binance has been known to block gcp
Do we solve this issue on your hosting? Previously, I faced a similar problem on a pythonanywhere hosting, and there the admin solved the problem...
unfortunately I doubt that's something railway would want to get into, if binance is blocking railway and gcp, its probably for a good reason, someone has abused binance's api before
thank you
I got a response from binance support that the error is appearing because the request is coming from a restricted region.
USA - blocked by binance.
M Most likely, the service server you are using is located in this region.
Can you transfer my project to a server in another region?
Regions are not available yet, but a planned feature. You'll be able to do this (this quarter or jake will eat a shoe) https://twitter.com/JustJake/status/1686863687414362112?s=20
thank you
And another question, I can not connect to the database.
I get an error
2003 (HY000): Can't connect to MySQL server on 'containers-us-west-194.railway.app:3306' (110), Why ?
Are you sure this port is correct? I don't think railway uses the default port for MySQL. You may need to set your reference variables.
https://docs.railway.app/databases/mysql
it turned out to connect to the postgres database, it does not write errors, but it does not save anything in the table, tell me, please, what am I doing wrong?
can you show us a screenshot of your service variables
thanks, the issue was resolved
I ran into another problem on the bybit exchange. Similarly, as on binance, I get errors when making requests via requests.get (). Error with such requests File "/opt/venv/lib/python3.8/site-packages/requests/models.py", line 975, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
That’s a code issue unfortunately, nothing we can help with there
my code works fine on my local machine
is what you are requesting blocking you
why ? whars wrong ?
that was a question for you
its my code import requests
response = requests.get('https://api.bybit.com/spot/v3/public/symbols')
print(response) reply on computer - <Response [200]>
reply on server - <Response [403]> for what reason on the server I do not receive a response
They could be blocking the GCP IP range
in which case you’ll have to run your request through a proxy
yep, 403, looks like they are blocking you or gcp
yes, bybit has confirmed the GCP blocking of the requested through USA. The problem is similar to binsnce. Is it possible to count on the solution of the issue with the change of the server country until the end of September?
railway only has one region at the moment, us-west1
& regions may not be a guaranteed solution. you should look into using a proxy or, instead of each individual exchange use an aggregator like cmc (they don't block us) https://coinmarketcap.com/api/documentation/v1/#tag/exchange