Opened 3 years ago

Last modified 2 years ago

#323 new defect

pycsw - inconsistent path requirements for admin vs. front end

Reported by: TC Haddad Owned by: Jeff McKenna
Priority: enhancement Milestone: 5.0.0 release
Component: MS4W - Packages Version: 4.0.5
Keywords: pycsw Cc: TC Haddad
Blocked By: Blocking:


This is probably not only an MS4W issue, but it is probably specific to Windows users of pycsw, so noting it here with examples from the MS4W demo:

The main admin tool for pycsw is '' as documented here:

It appears that this script is requiring a full drive path in the configuration settings, for access to the pycsw database:


Without a full path, the script will throw an error complaining about not being able to find the database.

sqlite3.OperationalError: unable to open database file
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) unable to open database file

Meanwhile, the main pycsw application is accessed via the browser at:

For this to work, the it seems the path to the database should not have the drive letter configured as in


Without this version of the path, the main pycsw application will return an error of:

<!-- pycsw 2.6.0 -->
<ows20:ExceptionReport version="3.0.0" xml:lang="en-US" xsi:schemaLocation="">
<ows20:Exception exceptionCode="NoApplicableCode" locator="service">
<ows20:ExceptionText>Could not initialize repository. Check server logs</ows20:ExceptionText>

It would be convenient if both the pycsw admin and the pycsw front-end could operate using the same path configuration to the database, as it is inconvenient to switch between the two (although no restart is required, so it's not as bad as it could be).

I found an old unresolved stack exchange question that seemed like it could be related, so I think this is Windows specific rather than MS4W specific:

Not sure if you would try to handle it for MS4W, or pass to the pycsw folks?

Change History (3)

comment:1 by Jeff McKenna, 3 years ago

(sorry for my delay in responding, I wanted to give some good testing before responding)

I cannot replicate the error mentioned above. The relative path works for me through both the commandline and Apache:


Can you let me know what exact command you are trying, and which directory you are in when you issue the command?

For example, since the 'database' path in default.cfg is relative to the C:/ms4w/pycsw-2.6.0/ directory, all subsequent commandline requests should be done while inside that same directory, such as:

cd ms4w
cd pycsw-2.6.0
python bin/ -c setup_db -f default.cfg

or to load records into that new SQLite file, cd into C:/ms4w/pycsw-2.6.0/ and then:

python bin/ -c load_records -f default.cfg -p tests/functionaltests/suites/cite/data

Maybe this needs stating in the README, if yes please let me know. Thanks for this testing feedback!!

comment:2 by TC Haddad, 3 years ago

Thanks for the tip, you are correct I wasn't in that directory. Here's what I was doing:

python C:\ms4w\apps\pycsw-2.6.0\bin\ -c load_records -f C:\ms4w\apps\pycsw-2.6.0\default.cfg -p C:\metadata\noaa\nos\test

To be honest, I thought doing this way meant that it didn't matter which directory I was running from because the script would run from the path specified, and everything the script needs would be relative from the various locations specified. But I stand corrected! Apologies for the false alarm...

comment:3 by Jeff McKenna, 2 years ago

Milestone: 4.1.0 release5.0.0 release

Milestone renamed

Note: See TracTickets for help on using tickets.