Graham,

Thank you I think you have set me on the course to a resolution.  Thank you 
so much for your help.  If you're interested you can see responses in line 
below...

On Thursday, January 31, 2013 5:40:29 PM UTC-5, Graham Dumpleton wrote:
>
> What is in the directory:
>
> /usr/qnx650/host/qnx6/x86/usr/lib/
>

This is where the QNX distribution has there built in Python.  The listing 
is...
# ls /usr/qnx650/host/qnx6/x86/usr/lib/

.

..

gcc

python2.5


When I run 'python', it runs this one which is 2.5.2.  I'm not sure why 
their distribution places that stuff there.  For one, it's a lot of tab'ing 
just to get the path in the shell.  I'm sure there is probably some very 
good reason that is beyond my level of understanding.

 


> It looks like you have two Python installations installed, one under:
>
> /usr/qnx650/host/qnx6/x86/usr
>
> and another under:
>
> /usr/pkg
>
> These are different patch level revisions and mod_wsgi is compiled against 
> the later meaning it it forced to use the shared library for that.
>

I think that pkg_add installed python2.5 at /usr/pkg when I added 
ap22-py25-wsgi-3.3 from the packages hosted at netbsd.  This is the one 
used by wsgi from apache and hence why it returns version 2.5.6.
 

>
> At run time however, because PATH includes 
> /usr/qnx650/host/qnx6/x86/usr/bin before /usr/pkg/bin, it is finding the 
> 'python' executable there first. It doesn't execute that, as Python is 
> linked into mod_wsgi.so file, but it uses it as an anchor reference point 
> to work out where the lib/python2.5 directory is. Thus is using wrong lib 
> directory, one which is not the one mod_wsgi.so is compiled for.
>
  
Yep. I never would have guessed there were two.  Thanks 
for interpreting the output of ldd for me. I had previously performed that 
check from reading the wiki, but it didn't dawn on me that the 
/usr/pkg/lib/libpython2.5.so.1.0 entry should have read something like 
/usr/qnx650/host/qnx6/x86/usr/lib/libpython2.5.so.1.0 since that's where my 
python path was pointing.

What you would have to do is the following, presuming you cannot recompile 
> mod_wsgi from source code.
>
> 1. Do not use 'python' from /usr/qnx650/host/qnx6/x86/usr/bin, always use 
> /usr/pkg/bin/python.
> 2. Preferably use a Python virtualenv and install all the extra Python 
> modules you need into that. You need to have constructed that Python 
> virtualenv using /usr/pkg/bin/python.
> 3. Set WSGIPythonHome directive in the Apache configuration to refer to 
> the value of sys.prefix from running 'python' out of your virtualenv.
>
> The virtualenv is good because it means you aren't installing extra Python 
> packages into your system Python area, but a separate are. We can also 
> force mod_wsgi to use that for lib files using WSGIPythonHome.
>
> For some more details on setting up for virtual environments read:
>
> http://code.google.com/p/modwsgi/wiki/VirtualEnvironments
>
> Hopefully that gives you a sense of what the likely problem is. 
> Specifically, mixing different Python installations, shared library and lib 
> files, can cause strange issues to occur, with failed import like you are 
> seeing for a system module being one of them.
>
> Graham
>
>
> On 1 February 2013 09:22, Nathan Wright <[email protected] 
> <javascript:>>wrote:
>
>> From the command line...
>>
>> >>> print sys.prefix
>>
>> /usr/qnx650/host/qnx6/x86/usr
>>
>>
>> From /usr/pkg/etc/httpd/httpd.conf
>>
>> LoadModule wsgi_module lib/httpd/mod_wsgi.so
>>
>> WSGIScriptAlias / /usr/pkg/share/djroot/mars/mars/wsgi.py
>>
>> <Directory /usr/pkg/share/djroot/mars/mars>
>>
>> <Files wsgi.py>
>>
>> Order deny,allow
>>
>> Allow from all
>>
>> </Files>
>>
>> </Directory>
>>
>>
>> From ldd...
>>
>> # ldd /usr/pkg/lib/httpd/mod_wsgi.so
>>
>> /usr/pkg/lib/httpd/mod_wsgi.so
>>
>> mod_wsgi.so => /usr/pkg/lib/httpd/mod_wsgi.so (0xb8200000)
>>
>> libpython2.5.so.1.0 => /usr/pkg/lib/libpython2.5.so.1.0 (0xb8222000)
>>
>> libm.so.2 => /lib/libm.so.2 (0xb8375000)
>>
>>
>> Thank you for your help thus far!
>> Nathan
>>
>>  
>>
>>  
>>
>>  
>>
>>  
>>
>>  
>>
>>  
>>
>>  
>>
>>
>>
>> On Thursday, January 31, 2013 4:14:17 PM UTC-5, Graham Dumpleton wrote:
>>
>>> What is sys.prefix for command line Python?
>>>
>>> What WSGI directives do you have in the Apache configuration?
>>>
>>> If there is an equivalent command to ldd on QNX, can you find out if the 
>>> mod_wsgi.so is dynamically linking a Python shared library, or has a 
>>> statically linked one. Sounds like it could be the latter and the 
>>> mod_wsgi.so doesn't match the Python installation.
>>>
>>> Graham
>>>
>>>
>>> On 1 February 2013 03:13, Nathan Wright <[email protected]> wrote:
>>>
>>>> Yes.  From root and as www.
>>>>
>>>> I expanded the hello world test app with most of the stuff on the 
>>>> http://code.google.com/p/**modwsgi/wiki/**CheckingYourInstallation<http://code.google.com/p/modwsgi/wiki/CheckingYourInstallation>page.
>>>>   It's now...
>>>>
>>>>
>>>> import sys
>>>> import os
>>>>
>>>> def application(environ, start_response):
>>>>     status = '200 OK'
>>>>     
>>>>     output = 'Hello World!\n\n'
>>>>     output += 'sys.version = %s\n' % repr(sys.version)
>>>>     output += 'sys.prefix = %s\n' % repr(sys.prefix)
>>>>     output += 'sys.path = %s\n' % repr(sys.path)
>>>>     output += 'mod_wsgi.process_group = %s\n' % repr(environ['mod_wsgi.
>>>> **process_group'])
>>>>     output += 'mod_wsgi.application_group = %s\n' % 
>>>> repr(environ['mod_wsgi.**application_group'])
>>>>     output += 'wsgi.multithread = %s\n' % repr(environ['wsgi.**
>>>> multithread'])
>>>>     output += 'os.environ = %s\n' % repr(os.environ)
>>>>     
>>>>     response_headers = [('Content-type', 'text/plain'),
>>>>                              ('Content-Length', str(len(output)))]
>>>>     start_response(status, response_headers)
>>>>     
>>>>     return [output]
>>>>
>>>> ...and it's output is...
>>>>
>>>> Hello World!
>>>>
>>>> sys.version = '2.5.6 (r256:88840, Nov 26 2011, 01:20:32) \n[GCC 4.4.2]'
>>>> sys.prefix = '/usr/qnx650/host/qnx6/x86/**usr'
>>>> sys.path = ['/usr/qnx650/host/qnx6/x86/**usr/lib/python25.zip', 
>>>> '/usr/qnx650/host/qnx6/x86/**usr/lib/python2.5', 
>>>> '/usr/qnx650/host/qnx6/x86/**usr/lib/python2.5/plat-qnx6', 
>>>> '/usr/qnx650/host/qnx6/x86/**usr/lib/python2.5/lib-tk', 
>>>> '/usr/qnx650/host/qnx6/x86/**usr/lib/python2.5/lib-dynload'**, 
>>>> '/usr/qnx650/host/qnx6/x86/**usr/lib/python2.5/site-**packages']
>>>> mod_wsgi.process_group = ''
>>>> mod_wsgi.application_group = 'localhost.localdomain|'
>>>> wsgi.multithread = False
>>>> os.environ = {'PHOTON': '/dev/photon', 'PHFONT': '/dev/phfont', 
>>>> 'LD_LIBRARY_PATH': 
>>>> '/usr/pkg/lib:/proc/boot:/lib:**/usr/lib:/lib/dll:/opt/lib:/**usr/photon/lib:/usr/photon/**dll:/usr/local/lib:/opt/X11R6/**lib:/usr/X11R6/lib',
>>>>  'QNX_CONFIGURATION': '/etc/qnx', 'QNX_HELP_PATH': 
>>>> '/usr/qnx650/target/qnx6/usr/**help/product', 'PATH': 
>>>> '/sbin:/usr/sbin:/bin:/usr/**bin:/usr/photon/bin:/usr/**photon/appbuilder:/opt/X11R6/**bin:/usr/X11R6/bin:/usr/local/**bin:/opt/bin:/opt/sbin:/usr/**qnx650/host/qnx6/x86/usr/bin:/**usr/qnx650/host/qnx6/x86/usr/**sbin:/usr/qnx650/host/qnx6/**x86/sbin:/usr/qnx650/host/**qnx6/x86/bin:/usr/qnx650/host/**qnx6/x86/usr/photon/**appbuilder:/usr/pkg/bin:/usr/**pkg/sbin',
>>>>  'HOME': '/root', 'PHFIXROP': '1', 'DISPLAY': '127.1:0', 'MAKEFLAGS': 
>>>> '-I/usr/qnx650/target/qnx6/**usr/include', 'TERM': 'qansi-m', 'SHELL': 
>>>> '/bin/sh', 'PROCESSOR': 'x86', 'PHOTON2_PATH': '/usr/photon', '_': 
>>>> '/usr/pkg/sbin/httpd', 'PHTK_PATH': '/usr/photon', 'QNX_HOST': 
>>>> '/usr/qnx650/host/qnx6/x86', 'QNX_HELP_HOME_PAGE': 
>>>> '/usr/qnx650/target/qnx6/usr/**help/product/momentics/**bookset.html', 
>>>> 'USER_NAME': '/dev/photon', 'SYSNAME': 'nto', 'PHINSTANCE': '1', 
>>>> 'PHSTART': '1', 'TMPDIR': '/tmp', 'ABLANG': 'en_US', 'QNX_TARGET': 
>>>> '/usr/qnx650/target/qnx6', 'HOSTNAME': 'localhost', 'ABLPATH': 
>>>> '/usr/photon/translations', 'PHWM': 'pwm', 'PHOTON_PATH': '/usr/photon', 
>>>> 'LOGNAME': 'root', 'USER': 'root'}
>>>>
>>>>  
>>>> The only item striking me funny is that when running from the 
>>>> interpreter sys.version is different.  From the interpreter it is...
>>>>
>>>> 2.5.2 (r252:60911, Feb 24 2010, 17:29:58) [GCC 4.4.2]
>>>>
>>>> Why does Apache think it's 2.5.6?
>>>>
>>>>
>>>> On Thursday, January 31, 2013 10:44:17 AM UTC-5, Shooter wrote:
>>>>
>>>>> Can you import the time module from the Python interactive prompt? 
>>>>>
>>>>> --S. 
>>>>>
>>>>> On Jan 31, 2013, at 04:55, Nathan Wright wrote: 
>>>>>
>>>>> > Greeting group, 
>>>>> > 
>>>>> > I am experiencing an odd error when Apache (as www) tries to import 
>>>>> time through modwsgi.  I am using the QNX 6.5 operating system.  Their 
>>>>> community has a pkgsrc project and I'm using their packages hosted at 
>>>>> ftp://ftp.netbsd.org/pub/**pkgsr**c/packages/QNX/i386/6.5.**0_**
>>>>> head_20110826/All/<ftp://ftp.netbsd.org/pub/pkgsrc/packages/QNX/i386/6.5.0_head_20110826/All/>.
>>>>>  
>>>>>  I'm running QNX in a VirtualBox VM. 
>>>>> > 
>>>>> > I'm running... 
>>>>> >         • Apache 2.2.19 (apache-2.2.19.tgz) 
>>>>> >         • Python 2.5 (included in QNX distribution) 
>>>>> >         • modwsgi 3.3 (ap22-py25-wsgi-3.3.tgz) 
>>>>> > This simple test app works fine... 
>>>>> > 
>>>>> > import sys 
>>>>> > import os 
>>>>> > 
>>>>> > def application(environ, start_response): 
>>>>> > status = '200 OK' 
>>>>> > output = 'Hello World!\n' 
>>>>> > response_headers = [('Content-type', 'text/plain'), 
>>>>> >  ('Content-Length', str(len(output)))] 
>>>>> > start_response(status, response_headers) 
>>>>> > return [output] 
>>>>> > 
>>>>> > However this app doesn't... 
>>>>> > 
>>>>> > import time 
>>>>> >   
>>>>> > def application(environ, start_response): 
>>>>> > status = '200 OK' 
>>>>> > output = 'The time is %s\n' % repr(time.ctime()) 
>>>>> > response_headers = [('Content-type', 'text/plain'), 
>>>>> >  ('Content-Length', str(len(output)))] 
>>>>> > start_response(status, response_headers) 
>>>>> > return [output] 
>>>>> >   
>>>>> > It fails on import time.  At first I spent time attempting to figure 
>>>>> how my permissions were wrong, and where this darn time module was.  I 
>>>>> discovered that it is apparently built in to the python binary (I think)? 
>>>>>  I am baffled why modwsgi could import sys and os but not time.   
>>>>> > 
>>>>> > Anyone have any suggestions on next steps? 
>>>>> > 
>>>>> > Much appreciated, 
>>>>> > Nathan 
>>>>> > 
>>>>> > -- 
>>>>> > You received this message because you are subscribed to the Google 
>>>>> Groups "modwsgi" group. 
>>>>> > To unsubscribe from this group and stop receiving emails from it, 
>>>>> send an email to modwsgi+u...@**googlegroups.com. 
>>>>> > To post to this group, send email to [email protected]. 
>>>>> > Visit this group at 
>>>>> > http://groups.google.com/**group**/modwsgi?hl=en<http://groups.google.com/group/modwsgi?hl=en>.
>>>>> >  
>>>>>
>>>>> > For more options, visit 
>>>>> > https://groups.google.com/**grou**ps/opt_out<https://groups.google.com/groups/opt_out>.
>>>>> >  
>>>>>
>>>>> >   
>>>>> >   
>>>>>
>>>>>  -- 
>>>> You received this message because you are subscribed to the Google 
>>>> Groups "modwsgi" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>> an email to modwsgi+u...@**googlegroups.com.
>>>> To post to this group, send email to [email protected].
>>>> Visit this group at 
>>>> http://groups.google.com/**group/modwsgi?hl=en<http://groups.google.com/group/modwsgi?hl=en>
>>>> .
>>>> For more options, visit 
>>>> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
>>>> .
>>>>  
>>>>  
>>>>
>>>
>>>  -- 
>> You received this message because you are subscribed to the Google Groups 
>> "modwsgi" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> To post to this group, send email to [email protected]<javascript:>
>> .
>> Visit this group at http://groups.google.com/group/modwsgi?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/modwsgi?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to