SQLAlchemy : Location error

I am having error while connecting to postgres with the following

DSN: postgres://postgres:posrgres@localhost:5432/postgres

Error: Location Error

Why do you create a new thread with the same amount of lacking information?

Perhaps you want to read and understand



i am new so please guide me

In order to help you, we need the full error information.

The error above looks like one related to an execption (indicated by
the Error: prefix). For those errors, you find the information we need
in the error_log object. You access it via the ZMI (= "Zope Management Interface"); its url is url_to_your_plone/error_log/manage_main. You see there a list of recent exceptions; to get the details for one of them, click on its entry. Copy those details in your post and enclose the whole copies block in "````" (which means to keep the formatting).

The error above does not look like an SQLAlchemy related error. Location Error typically means that you try to access a missing attribute or key. The error details will tell where the exception comes from.

I tried to access the error log page and couldn't find the Location Error in the list. Below is the error when I try to add the connection

Site Error
An error was encountered while publishing this resource.

Error Type: LocationError
Error Value: ({'username': 'postgres', 'extension_options': {'initial_state': 'invalidated'}, 'DSN': 'postgres://postgres:postgres@lcoalhost:5432/postgres', 'host': 'lcoalhost', 'twophase': False, 'session_options': {}, 'drivername': 'postgres', 'password': u'postgres', 'dbname': 'postgres', 'engine_options': {'convert_unicode': 0, 'encoding': 'UTF-8'}, 'url': postgres://postgres:***@lcoalhost:5432/postgres, 'transactional': True, 'port': 5432, 'dsn': 'postgres://postgres:postgres@lcoalhost:5432/postgres'}, '?k')

This is strange.

I see two potential reasons:

  1. there are more error_log objects around; maybe, you looked into the wrong one. Likely, you must look into the one in your Plone (not in the Zope "Root Folder").
  2. error_log allows to ignore some exceptions. LocationError typically is not ignored - but maybe in your case. You control the ignored exceptions via the ZMI page of the respective error_log object. Verify that LocationError is not ignored.

The Error Value above tells you in connection with a LocationError which access went wrong: it tried to access ?k in a dict specifying postgres parameters. Obviously, this dict does not contain ?k.
?var used to be a special syntax specifying "use the value of var for the lookup". It might be possible that the new template engine ("chameleon") no longer supports this syntax. In this case, the template would need to be rewritten to avoid no longer supported syntax.

To get more relevant information, I see two options:

  1. you retry to find the detailed error information in the (a) error_log object
  2. you look into your logfile (it typically is located in the file system under var/instance/event.log with instance either instance or client1 (depending on the type of your Plone installation). In addition to maintaining exception entries, the error_log objects also log exceptions to the log file (provided those exception are not ignored).

how to make plone ignore the location error

Which errors are ignored is controlled in the ZMI (= "Zope Management Interface") of the respective error_log object. View such an ZMI page
(remember url_to_plone_portal/error_log/manage_main), carefully look at the page and you will see where this happens.

Note that you do not want LocationError to be ignored (and this is the default - thus, likely, your error_log objects will currently not have them ignored).

Without knowing much about this subject: I think you misunderstand here.

The Location error shows up because 'something is wrong'.
If you change you error log settings, it will still not work.

You need to figure out WHY something is wrong.
(a bug ? your setup ? etc)

I tried reinstalling it and same problem occurs

err... did you use cut & paste to include your error message on this forum or did you use your fingers to type it ?

typed it sorry..

I changed it to localhost but didn't work

From your 2 replies I can either conclude that:

  1. you did not use copy/paste to reproduce exactly the error message (that's a mistake you should really not do anymore, always paste from your console to get an exact error message)
  2. or you really mistyped localhost in your configuration

whatever, what is needed is to be sure that your postgres configuration is correct outside of Plone before going further.

From old config file I am grabbing this:
sudo -u postgres psql -h localhost -U -d -W
I can't remember what this is meaning exactly, but did you actually do this test ?

In python I have also this snippet:

import psycopg2
c=psycopg2.connect("host=localhost dbname=mydbname user=myuser password=mypwd")

changing user and password and using the python setup for plone, of course

You should have all this working before posting about SqlAlchemy on this forum because if all this is not functional this is not a Plone problem.

i am using SQLAlchemy tried this url too but couldnt figureout