« Return to Thread: New user small problem
I figured the above problem out it was just a small code error.Zer033 wrote:I got it all to compile and the new files added to the VS solution folder were:Zer033 wrote:What is the environmental variable I have to set exactly and then what option in my VS solution do I put it under. Is it just an environmental variable for the swig root folder? Then after that in the VS solution settings where is it that I include it.wsfulton wrote:Zer033 wrote:
>
>
> Zer033 wrote:
>>
>>
>> Christopher Barker wrote:
>>> This looks like you're having trouble with running SWIG itself, not yet
>>> with compiling the results. I think another poster has suggested a fix.
>>>
>>> However, when you do get to the compiling stage, I highly recommend that
>>> you use distutils and a setup.py file to compile the extension , it is
>>> by far the easiest way to compile python extensions.
>>>
>>> I recently added directions to the SWIG docs. I don't know that they've
>>> made it to the released version, but you can find them in svn here:
>>>
>>> http://swig.svn.sourceforge.net/viewvc/*checkout*/swig/trunk/Doc/Manual/Python.html
>>>
>>> -Chris
>>>
>>>
>>> --
>>> Christopher Barker, Ph.D.
>>> Oceanographer
>>>
>>> Emergency Response Division
>>> NOAA/NOS/OR&R (206) 526-6959 voice
>>> 7600 Sand Point Way NE (206) 526-6329 fax
>>> Seattle, WA 98115 (206) 526-6317 main reception
>>>
>>> Chris.Barker@noaa.gov
>>>
>>> -------------------------------------------------------------------------
>>> SF.Net email is sponsored by: The Future of Linux Business White Paper
>>> from Novell. From the desktop to the data center, Linux is going
>>> mainstream. Let it simplify your IT future.
>>> http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
>>> _______________________________________________
>>> Swig-user mailing list
>>> Swig-user@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/swig-user
>>>
>>>
>> Chris,
>> I think that is the problem. What is it I'm supposed to do with the
>> "swigwin-1.3.33" folder in relation to my VS solution. I can't find any
>> specific steps concerning that. I did set the python environmental
>> variables though and that seems to be okay.
>>
>> Also to the above poster about the Examples/python things working after
>> setting environmental variables that didn't work for me either. I think
>> it is related to me just not installing or incorporating swig folder
>> properly with my solution.
>>
>
> Oh forgot to mention here is the new errors so I think it does have
> something to do with how I am trying to incorporate the swig folder with my
> VS Solution.
>
> Generating Code...
> Compiling manifest to resources...
> Linking...
> LINK : _example.pyd not found or not built by the last incremental link;
> performing full link
> Embedding manifest...
> SWIG
> (1): Error: Unable to find 'swig.swg'
> (3): Error: Unable to find 'python.swg'
> Project : error PRJ0019: A tool returned an error code from "SWIG"
> Build log was saved at "file://c:\Documents and Settings\Blake
> Nicholas\Desktop\interfaceDLLexample\interfaceDLLexample\Debug\BuildLog.htm"
> interfaceDLLexample - 1 error(s), 1 warning(s)
The 2 errors above occur when the SWIG_LIB environment variable is not
set correctly. However, for Windows, if you are using the executable
supplied in swig.exe, you don't need to set this environment variable
unless you have messed around with the location of swig.exe. Basically
if you just unzip swigwin-1.3.33.zip (see comment in the zip file), set
the target language environment variables as described in Windows.html
and then open up the example visual studio solution files, the examples
will just work.
William
-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell. From the desktop to the data center, Linux is going
mainstream. Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
Swig-user mailing list
Swig-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/swig-user
example.py, _example.exp, _example.lib, and _example.pyd.
I open up python and try it out and it doesn't work like the tutorial.
The tutorial says type:
import example
which gives no errors
so I type
example.fact(5)
when I do this I get this error
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
example.fact(5)
AttributeError: 'module' object has no attribute 'fact'
so at first I didn't think it was working at all, but this works
example.example.fact(5)
It works as far as existing unlike the one above, but doesn't give the answer back. I guess this is because I made example a class with header/cpp files. So I know how I could rearrange the code and get example.fact(5) working.
The thing I'm interested in is when I type
example.example.fact(5)
I get this error
Traceback (most recent call last):
File "<pyshell#4>", line 1, in <module>
example.example.fact(5)
TypeError: unbound method fact() must be called with example instance as first argument (got int instance instead)
Just for curiosity and the possibility I might encounter it in a more complex project later what does this mean?
Also thanks for all your help so far I do understand how to use swig and python now and could do it with other projects.
« Return to Thread: New user small problem
| Free embeddable forum powered by Nabble | Forum Help |