Opened 4 years ago

Last modified 3 months 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.1 release
Component: MS4W - Packages Version: 4.0.5
Keywords: pycsw Cc: TC Haddad
Blocked By: Blocking:

Description

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 'pycsw-admin.py' as documented here:
https://docs.pycsw.org/en/stable/administration.html

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

database=sqlite:///C:\\ms4w\\apps\\pycsw-2.6.0\\tests\\functionaltests\\suites\\cite\\data\\cite.db

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:
http://127.0.0.1/pycsw?SERVICE=CSW&REQUEST=GetCapabilities

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

database=sqlite:///tests\\functionaltests\\suites\\cite\\data\\cite.db

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="http://www.opengis.net/ows/2.0 http://schemas.opengis.net/ows/2.0/owsExceptionReport.xsd">
<ows20:Exception exceptionCode="NoApplicableCode" locator="service">
<ows20:ExceptionText>Could not initialize repository. Check server logs</ows20:ExceptionText>
</ows20:Exception>
</ows20:ExceptionReport>

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:

https://gis.stackexchange.com/questions/95304/how-to-set-up-pycsw-on-xampp-win7

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

Change History (4)

comment:1 by Jeff McKenna, 4 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:

database=sqlite:///tests\\functionaltests\\suites\\cite\\data\\cite-test.db

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
setenv.bat
cd pycsw-2.6.0
python bin/pycsw-admin.py -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/pycsw-admin.py -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, 4 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\pycsw-admin.py -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, 3 years ago

Milestone: 4.1.0 release5.0.0 release

Milestone renamed

comment:4 by Jeff McKenna, 3 months ago

Milestone: 5.0.0 release5.0.1 release

@tchaddad can you test all of this with MS4W 5.0 ?

Note: See TracTickets for help on using tickets.