peewee.OperationalError: could not connect to server: No such file or directory

1,135 views
Skip to first unread message

seyed...@noaa.gov

unread,
Dec 16, 2016, 11:37:39 PM12/16/16
to peewee-orm
I am installing peewee and weppy on a new mac os. My application works on Windows but I'm having the following issue with the mac, anyone have any suggestions?









During handling of the above exception, another exception occurred:




Traceback (most recent call last):


  File "/Users/USER/Documents/BudgetDB/BudgetEnv/venv/lib/python3.4/site-packages/weppy/handlers.py", line 23, in handled_function


    handler.on_start()


  File "/Users/USER/Documents/BudgetDB/webapp/budget.py", line 56, in on_start


    database.connect()


  File "/Users/USER/Documents/BudgetDB/BudgetEnv/venv/lib/python3.4/site-packages/peewee.py", line 3602, in connect


    self.initialize_connection(self._local.conn)


  File "/Users/USER/Documents/BudgetDB/BudgetEnv/venv/lib/python3.4/site-packages/peewee.py", line 3514, in __exit__


    reraise(new_type, new_type(*exc_args), traceback)


  File "/Users/USER/Documents/BudgetDB/BudgetEnv/venv/lib/python3.4/site-packages/peewee.py", line 134, in reraise


    raise value.with_traceback(tb)


  File "/Users/USER/Documents/BudgetDB/BudgetEnv/venv/lib/python3.4/site-packages/peewee.py", line 3600, in connect


    **self.connect_kwargs)


  File "/Users/USER/Documents/BudgetDB/BudgetEnv/venv/lib/python3.4/site-packages/peewee.py", line 3990, in _connect


    conn = psycopg2.connect(database=database, **kwargs)


  File "/Users/USER/Documents/BudgetDB/BudgetEnv/venv/lib/python3.4/site-packages/psycopg2/__init__.py", line 164, in connect


    conn = _connect(dsn, connection_factory=connection_factory, async=async)


peewee.OperationalError: could not connect to server: No such file or directory


        Is the server running locally and accepting


        connections on Unix domain socket "/tmp/.s.PGSQL.5432"?



Charles Leifer

unread,
Dec 17, 2016, 10:23:12 AM12/17/16
to peewe...@googlegroups.com
It looks like Postgres isn't running.

--
You received this message because you are subscribed to the Google Groups "peewee-orm" group.
To unsubscribe from this group and stop receiving emails from it, send an email to peewee-orm+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

seyed...@noaa.gov

unread,
Dec 17, 2016, 11:44:52 PM12/17/16
to peewee-orm
Here's what I get with pip freeze

APScheduler==3.3.0


click==6.6


fpdf==1.7.2


peewee==2.8.5


psycopg2==2.6.2


pyaes==1.6.0


pyDAL==16.9


pyldap==2.4.25.1


pytz==2016.10


PyYAML==3.12


six==1.10.0


SQLAlchemy==1.1.4


tzlocal==1.3


udatetime==0.0.11


weppy==0.8.5


weppy-BS3==0.4




I'm using VPN to connect to postgres db remotely, do I need to pip install anything else locally to get around this error or is it firewall related?
To unsubscribe from this group and stop receiving emails from it, send an email to peewee-orm+...@googlegroups.com.

Ryan O'Donnell

unread,
Dec 18, 2016, 10:29:38 AM12/18/16
to peewe...@googlegroups.com
Can you test connecting to Postgres outside of Python and see what happens? 

To unsubscribe from this group and stop receiving emails from it, send an email to peewee-orm+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--

Ryan O'Donnell

Charles Leifer

unread,
Dec 18, 2016, 12:43:47 PM12/18/16
to peewe...@googlegroups.com
Your environment looks good, all you need is psycopg2. The error you're seeing indicates that you're not able to connect to the postgres db, however.

seyed...@noaa.gov

unread,
Dec 18, 2016, 11:54:27 PM12/18/16
to peewee-orm
Thanks Ryan/Charles.

Looks like the issue was the connection string. I believe I used to have the following working

database = PostgresqlDatabase('DBNAME', {'user': 'USER', 'host': 'HOST', 'password': 'PASSWORD', 'port': 'PORT'})

but once I changed it to the following it works

database = PostgresqlDatabase('DBNAME', user= 'USER', host= 'HOST', password= 'PASSWORD', port= 'PORT')

not sure what happened from my move from windows to mac but it's all good now


--

Ryan O'Donnell

--
You received this message because you are subscribed to the Google Groups "peewee-orm" group.
Reply all
Reply to author
Forward
0 new messages