Python error when running the WSGI as a standalone Mapnik OGC Server:

View: New views
3 Messages — Rating Filter:   Alert me  

Python error when running the WSGI as a standalone Mapnik OGC Server:

by John Mitchell-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

To run the WSGI as a standalone Mapnik OGC Server:

I run the below line from the command prompt:

C:\Python25\python.exe "C:\Documents and Settings\jmitchell\Desktop\wmsWSGI.py"

I get the following error:
--------------------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Documents and Settings\jmitchell\Desktop\wmsWSGI.py", line 7, in <mod
ule>
    application = WSGIApp('C:/mapnik_0_6_1/example_code/wms/ogcserver.conf')
  File "c:\mapnik_0_6_1\site-packages\mapnik\ogcserver\wsgi.py", line 42, in __i
nit__
    raise ServerConfigurationError('The factory module could not be loaded.')
mapnik.ogcserver.exceptions.ServerConfigurationError: The factory module could n
ot be loaded.
--------------------------------------------------------------------------------

How can I fix the error "The factory module could not be loaded."

The map_factory.py file exists and the contents are listed below:
----------------------------------------------------
from mapnik.ogcserver.WMS import BaseWMSFactory

class WMSFactory(BaseWMSFactory):
  def __init__(self):
    BaseWMSFactory.__init__(self)
    #self.loadXML('/full/path/to/mapfile.xml')
    self.loadXML('C:/mapnik_0_6_1/osm.xml')
    self.finalize()
----------------------------------------------------
Why can't it be loaded?

John


_______________________________________________
Mapnik-users mailing list
Mapnik-users@...
https://lists.berlios.de/mailman/listinfo/mapnik-users

Re: Python error when running the WSGI as a standalone Mapnik OGC Server:

by Dane Springmeyer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Nov 5, 2009, at 5:33 PM, John Mitchell wrote:

To run the WSGI as a standalone Mapnik OGC Server:

I run the below line from the command prompt:

C:\Python25\python.exe "C:\Documents and Settings\jmitchell\Desktop\wmsWSGI.py"

I get the following error:
--------------------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Documents and Settings\jmitchell\Desktop\wmsWSGI.py", line 7, in <mod
ule>
    application = WSGIApp('C:/mapnik_0_6_1/example_code/wms/ogcserver.conf')
  File "c:\mapnik_0_6_1\site-packages\mapnik\ogcserver\wsgi.py", line 42, in __i
nit__
    raise ServerConfigurationError('The factory module could not be loaded.')
mapnik.ogcserver.exceptions.ServerConfigurationError: The factory module could n
ot be loaded.
--------------------------------------------------------------------------------

How can I fix the error "The factory module could not be loaded."

Oh, on windows... Well, normally on *nix systems you would change into the directory of the script and do:

$ python wmsWSGI.py

and then if the map_factory.py file were in the same directory it would automatically be found, since the current working directory is automatically in sys.path.

Alternatively you can put the directories on your path where 'map_factory.py' is, by putting this in the top of your 'wmsWSGI.py' script:

import sys
WORKING_DIR = os.path.dirname(os.path.abspath(__file__))
# add to sys.path the folder that contains map_factory.py (and ogcserver.conf)
sys.path.append(WORKING_DIR)

Also make sure in 'ogcserver.conf' you have:

module=map_factory # without the .py

Dane


_______________________________________________
Mapnik-users mailing list
Mapnik-users@...
https://lists.berlios.de/mailman/listinfo/mapnik-users

Re: Python error when running the WSGI as a standalone Mapnik OGC Server:

by Dane Springmeyer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Nov 5, 2009, at 5:33 PM, John Mitchell wrote:

To run the WSGI as a standalone Mapnik OGC Server:

I run the below line from the command prompt:

C:\Python25\python.exe "C:\Documents and Settings\jmitchell\Desktop\wmsWSGI.py"

I get the following error:
--------------------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Documents and Settings\jmitchell\Desktop\wmsWSGI.py", line 7, in <mod
ule>
    application = WSGIApp('C:/mapnik_0_6_1/example_code/wms/ogcserver.conf')
  File "c:\mapnik_0_6_1\site-packages\mapnik\ogcserver\wsgi.py", line 42, in __i
nit__
    raise ServerConfigurationError('The factory module could not be loaded.')
mapnik.ogcserver.exceptions.ServerConfigurationError: The factory module could n
ot be loaded.
--------------------------------------------------------------------------------

How can I fix the error "The factory module could not be loaded."

Oh, on windows... Well, normally on *nix systems you would change into the directory of the script and do:

$ python wmsWSGI.py

and then if the map_factory.py file were in the same directory it would automatically be found, since the current working directory is automatically in sys.path.

Alternatively you can put the directories on your path where 'map_factory.py' is, by putting this in the top of your 'wmsWSGI.py' script:

import sys
WORKING_DIR = os.path.dirname(os.path.abspath(__file__))
# add to sys.path the folder that contains map_factory.py (and ogcserver.conf)
sys.path.append(WORKING_DIR)

Also make sure in 'ogcserver.conf' you have:

module=map_factory # without the .py

Dane


_______________________________________________
Mapnik-users mailing list
Mapnik-users@...
https://lists.berlios.de/mailman/listinfo/mapnik-users