Cooke, Mark wrote:
>> -----Original Message----- From: [email protected] 
>> [mailto:[email protected]] On Behalf Of Ryan Steele Sent: 15
>> August 2011 20:13 To: [email protected] Subject: Re: [Trac] Re:
>> Migrating from SQLite to PostgreSQL
>> 
>> Cooke, Mark wrote:
>>> Seeing as you sound like someone capable of tinkering with code, what
>>> happens if you try to use pyscopg2 directly from a python prompt to
>>> access the backend dB you setup with that new project earlier?  Lets take
>>> Trac and the script out of this until we know that pyscopg2 works for
>>> your user OK...
>>> 
>>> ~ mark c
>>> 
>> Well, isn't psycopg2 required to perform 'trac-admin /path/to/trac initenv
>> ...' for a PG backend?  Since that worked, I would think that's a valid
>> test, unless you feel differently?
>> 
>> Cheers, Ryan
>> 
> Hmm, yes, I suppose so!  I know nothing about the script you mentioned and at
> the moment I am running out of ideas.  I just checked and someone claims that
> the script worked fine with 0.11 but that the last update was in 2008.
> 
> What is the command line you are using?
> 
> Perhaps someone else can suggest something?
> 
> ~ mark c
> 


I appreciate the help, anyways.  Maybe John Hampton will get a chance to hop in,
since he authored the script.

The command is:
./sqlite2pg.py -e /path/to/trac -p 'postgres://user:pass@localhost:5432/trac'


The stack trace is:
Traceback (most recent call last):
  File "./sqlite2pg.py", line 335, in <module>
    sys.exit(main(sys.argv[1:]))
  File "./sqlite2pg.py", line 331, in main
    Main(opts)
  File "./sqlite2pg.py", line 244, in Main
    pgenv = getPostgreSQLEnvironment(opts)
  File "./sqlite2pg.py", line 209, in getPostgreSQLEnvironment
    cnx = env.get_db_cnx()
  File "/usr/lib/python2.6/dist-packages/trac/env.py", line 285, in
get_db_cnx
    return DatabaseManager(self).get_connection()
  File "/usr/lib/python2.6/dist-packages/trac/db/api.py", line 90, in
get_connection
    connector, args = self._get_connector()
  File "/usr/lib/python2.6/dist-packages/trac/db/api.py", line 131, in
_get_connector
    raise TracError('Unsupported database type "%s"' % scheme)
trac.core.TracError: Unsupported database type "postgres"


The sys.path is:
['/root', '/usr/lib/python2.6', '/usr/lib/python2.6/plat-linux2',
'/usr/lib/python2.6/lib-tk', '/usr/lib/python2.6/lib-old',
'/usr/lib/python2.6/lib-dynload', '/usr/lib/python2.6/dist-packages',
'/usr/lib/python2.6/dist-packages/PIL', '/usr/lib/pymodules/python2.6',
'/usr/lib/pymodules/python2.6/gtk-2.0', 
'/usr/local/lib/python2.6/dist-packages']


The relevant modules are located in the path:
/usr/lib/python2.6/dist-packages/psycopg2
/usr/lib/python2.6/dist-packages/trac
/usr/lib/python2.6/dist-packages/trac/db/postgres_backend.py
/usr/lib/python2.6/dist-packages/trac/db/sqlite_backend.py


Debugging output shows it finds psycopg2, but doesn't load the PG connector:
has_psycopg: True
scheme: postgres
connectors: [<trac.db.sqlite_backend.SQLiteConnector object at 0x1c12b10>]
candidates: []


And, that's the reason it fails - the 'postgres' schema doesn't match any in the
candidates list.  If it's not a path issue, which it appears not to be, I'd
almost say it kinda feels like a namespace issue.  Others have reported this
problem (when the paths are correct), but unfortunately there are no resolutions
out there.


Cheers,
Ryan

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/trac-users?hl=en.

Reply via email to