3 months ago
Hello Railway team and community,
I’m experiencing a SyntaxError when importing the redis library in my Railway deployment with Python 3.12. The error appears as:
SyntaxError: multiple exception types must be parenthesized
File ".../redis/client.py", line 53
except socket.error, e:
Important details:
- On my local machine, the exact same project runs fine.
- Local environment uses redis==7.3.0.
- The error seems to originate from a cached or outdated Redis package in the Railway container.
- My FastAPI endpoints and Redis connection code are using proper Python 3 syntax:
```python
try:
r.ping()
except redis.exceptions.ConnectionError:
logger.error("Redis connection error")
1 Replies
Status changed to Awaiting Railway Response Railway • 3 months ago
2 months ago
the error means railway is installing a different older version of redis than your local redis==7.3.0, because that exact syntax "except socket.error, e:" was removed in python 3 and doesn't exist in redis 7.3.0
add this line temporarily at startup to check what version railway actually installed:
import redis print(redis.version)
once you see the version in your deploy logs you'll know exactly what's being installed and can force the correct version from there