[udunits] Issue with udunits / cfunit-python

Hi All,

I am trying to use udunit(2.1.24) with cfunit-python(trunk or 0.9.5)
package and I am getting some weird issue. I really appreciate if someone
can atleast point out the possible reasons/solution.

I have installed above packages on debian-6.0.6-amd64 platform. When I run
a sample standalone script, everything works fine. But when I deploy this
script under apache with mod_python/mod_wsgi, I get error: ValueError:
Can't set unsupported unit: 'hPa'

This may look an issue with apache modules, but whne I tried to debug the
udunits source code in details, I found that ut_parse function in
lib/parse.c returns null object when called from python test script under
apache+mod_python (but works fine with standalone python script). To give
you more details: specifically following conditions in udunits/lib/parser.c
become false:

 line 2275:  if (utparse() == 0) {

and this is because the yyparse/utparse() function in the same file returns
1 from below code:

line:1503

case 4:
#line 141 "parser.y"
    {
            YYABORT;
        }
    break;

The sample test script under apache+mod_python is:
from cfunits import Units

def index(req):
          try:
                u = Units('m/s')
          except (ValueError, TypeError) as e:
                return "Exception: " + str(e);
          else:
                return "Test : " + str(u);

And my apache site configuration is:

<VirtualHost *:80>
LoadModule python_module modules/mod_python.so

DocumentRoot /var/www/html
<Directory /var/www/html/>
  Options Indexes FollowSymLinks MultiViews
  AllowOverride None
  Order allow,deny
  allow from all
  AddHandler mod_python .py
  PythonHandler mod_python.publisher
  PythonDebug On
 </Directory>

</VirtualHost>

Can somepone point out the cause for this?

Regards,
Snehal
  • 2013 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the udunits archives: