But can you import _testInterface from Python when run in command line?

Graham

> On 31 Jul 2016, at 16:12, [email protected] wrote:
> 
> _testInterface is a .pyd file.
> Swig is creating testInterface.py which calls 
> _testInterface.testResponseType_Empty_swigconstant(_testInterface).
> 
> And yes, that _testInterface corresponds to a extension module compiled from 
> C++ code.
> 
> 
> 
>> On Friday, July 29, 2016 at 12:32:10 AM UTC+3, Graham Dumpleton wrote:
>> On a command line Python interpreter can you import ‘_testInterface’ and 
>> find that attribute you are after?
>> 
>> I am presuming that _testInterface corresponds to a extension module 
>> compiled from C code, is that correct?
>> 
>> Graham
>> 
>>> On 28 Jul 2016, at 11:47 PM, [email protected] wrote:
>>> 
>>> Hi All,
>>> 
>>> [Thu Jul 28 15:39:24.954612 2016] [wsgi:error] [pid 4708:tid 960] [client 
>>> 10.20.10.36:52869] mod_wsgi (pid=4708): Target WSGI script 'C:/Program 
>>> Files/ofer/test/RESTservice.wsgi' cannot be loaded as Python module.
>>> [Thu Jul 28 15:39:24.954612 2016] [wsgi:error] [pid 4708:tid 960] [client 
>>> 10.20.10.36:52869] mod_wsgi (pid=4708): Exception occurred processing WSGI 
>>> script 'C:/Program Files/ofer/test/RESTservice.wsgi'.
>>> [Thu Jul 28 15:39:24.954612 2016] [wsgi:error] [pid 4708:tid 960] [client 
>>> 10.20.10.36:52869] Traceback (most recent call last):
>>> [Thu Jul 28 15:39:24.954612 2016] [wsgi:error] [pid 4708:tid 960] [client 
>>> 10.20.10.36:52869]   File "C:/Program Files/ofer/test/RESTservice.wsgi", 
>>> line 4, in <module>
>>> [Thu Jul 28 15:39:24.954612 2016] [wsgi:error] [pid 4708:tid 960] [client 
>>> 10.20.10.36:52869]     from testService import app as application
>>> [Thu Jul 28 15:39:24.954612 2016] [wsgi:error] [pid 4708:tid 960] [client 
>>> 10.20.10.36:52869]   File "C:\\Program Files\\ofer\\test\\testService.py", 
>>> line 5, in <module>
>>> [Thu Jul 28 15:39:24.955612 2016] [wsgi:error] [pid 4708:tid 960] [client 
>>> 10.20.10.36:52869]     import testInterface
>>> [Thu Jul 28 15:39:24.955612 2016] [wsgi:error] [pid 4708:tid 960] [client 
>>> 10.20.10.36:52869]   File "C:\\Program 
>>> Files\\ofer\\test\\testInterface.py", line 94, in <module>
>>> [Thu Jul 28 15:39:24.955612 2016] [wsgi:error] [pid 4708:tid 960] [client 
>>> 10.20.10.36:52869]     
>>> _testInterface.testResponseType_Empty_swigconstant(_testInterface)
>>> [Thu Jul 28 15:39:24.955612 2016] [wsgi:error] [pid 4708:tid 960] [client 
>>> 10.20.10.36:52869] AttributeError: 'module' object has no attribute 
>>> 'testResponseType_Empty_swigconstant'
>>> 
>>> 
>>> I have 
>>> 
>>> Windows server 2008
>>> Apache 2.4 (mod_wsgi)
>>> Python 2.7.11
>>> Swigwin 3.0.10
>>> 
>>> 
>>> 
>>> swig_conversion.i
>>> %module testInterface
>>> %{
>>> #include "..\\testInterface\\testInterface.h"
>>> #include "..\\testInterface\\testTypes.h"
>>> 
>>> %}
>>> %include "std_wstring.i"
>>> %include "..\\testInterface\\testInterface.h"
>>> %include "..\\testInterface\\testTypes.h"
>>> 
>>> 
>>> 
>>> 
>>> setup.py
>>> from distutils.core import setup, Extension
>>> 
>>> 
>>> testInterface_module = Extension('_testInterface',
>>>                            sources=['swig_conversion_wrap.c', 
>>> 'swig_conversion_wrap.cxx'],
>>>                            )
>>> 
>>> setup (name = 'testInterface',
>>>        version = '0.1',
>>>        author      = "test module",
>>>        description = """Simple swig example from docs""",
>>>        ext_modules = [testInterface_module],
>>>        py_modules = ["testInterface"],
>>>        )
>>> 
>>> 
>>> httpd.conf
>>> ...
>>> <VirtualHost *:5000>
>>> 
>>>     SSLEngine off
>>>     SSLCertificateFile "C:\Program Files\ofer\test\Certs\hostcert.pem"
>>>     SSLCertificateKeyFile "C:\Program Files\ofer\test\Certs\hostkey.pem"
>>> 
>>>     #WSGIDaemonProcess testService threads=20 
>>> python-path=C:\Python27\Lib\site-packages  (this is in comment since 
>>> WSGIDeamonProcess is not available on Windows)
>>>     #WSGIApplicationGroup %{GLOBAL}
>>>     WSGIScriptAlias / "C:\Program Files\ofer\test\RESTservice.wsgi"
>>> 
>>>     LimitRequestFieldSize 1048576
>>>     LimitRequestLine 163840
>>> 
>>>     <Directory "C:\Program Files\ofer\test">
>>>             #<Files "testService.py">
>>>                     AllowOverride None
>>>                     Options Indexes FollowSymLinks
>>>                     Require all granted
>>>     #</Files>
>>>     </Directory>
>>> </VirtualHost>
>>> 
>>> 
>>> 
>>> RESTservice.wsgi
>>> import sys
>>> sys.path.insert(0, "C:\Program Files\ofer\test")
>>> 
>>> from testService import app as application
>>> 
>>> 
>>> 
>>> can someone help me solve this AttributeError?
>>> 
>>> Thanks,
>>> Ofer
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> -- 
>>> 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 https://groups.google.com/group/modwsgi.
>>> For more options, visit https://groups.google.com/d/optout.
> 
> -- 
> 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 https://groups.google.com/group/modwsgi.
> For more options, visit https://groups.google.com/d/optout.

-- 
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 https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.

Reply via email to