Remote interpreter behaves differently than manually running script via ssh
I'm trying to write a script on a remote server that uses psycopg2 to connect to a database on the remote server. When I run the file in Pycharm via the remote interpreter, I get a psycopg2 error. When I ssh into the server and run the file manually, it works. Any help?
An example that exhibits this behavior is:
import psycopg2
conn = psycopg2.connect("dbname=testdb")
print(conn.dsn)
This works fine if I ssh into the server and run. When I try to run it in Pycharm, I get this error:
ssh://user@remote:22/usr/bin/python3 -u local/testdb.py
Traceback (most recent call last):
File "remote/testdb.py", line 3, in <module>
conn = psycopg2.connect(dbname="testdb")
File "/usr/lib/python3/dist-packages/psycopg2/__init__.py", line 164, in connect
conn = _connect(dsn, connection_factory=connection_factory, async=async)
psycopg2.OperationalError: FATAL: role "USER" does not exist
Process finished with exit code 1
Please sign in to leave a comment.