[wingide-users] MacOSX 10.4: Twisted in WingIDE

Wingware Support support at wingware.com
Thu Sep 20 20:44:15 MDT 2007


Scott Syms wrote:
> I've installed twisted in the Mac's default python installation.  I can 
> import twisted modules in the python interpreter and the WingIDE 
> supplied python shell when I explicitly provided the python binary and 
> module paths in the projects definition.
> 
> However, when I write a twisted import statement in the script window, 
> it fails when I try to debug code- error is:
> 
> ImportError: No module named internet.protocol
> 
> Traceback (innermost last):
> 
> File "/Users/path/development/scratch/twisted.py", line 1, in ?
>   #!/bin/env python
> File "/Users/path/development/scratch/twisted.py", line 2, in ?
>   from twisted.internet.protocol import Protocol, Factory
> File "/Users/path/development/scratch/twisted.py", line 2, in ?
>   from twisted.internet.protocol import Protocol, Factory
> 
> The import lines are: 
> 
> from twisted.internet.protocol import Protocol, Factory
> from twisted.internet import reactor
> 
> This should work, but why am I getting different results from the 
> WingIDE shell and the debug interpreter?  Any workaround?

Are you starting the debug process from outside Wing?  The Python
Shell in Wing and the debug process if launched from Wing should
have identical environment (in fact the shell in Wing is implemented
using the debugger).

If launching from within Wing it would be work checking what
sys.path are in each case.

Oh, perhaps this is working in the shell because os.getcwd()
differs and you have '.' or a partial path on your sys.path?

You seem to be using Wing 2.1 but I'll just note that in
Wing 3.0 we add '.' to the sys.path when running in the
Python Shell but not in the debug process.  This would be
a possible explanation of the problem there.

Please let us know if none of this helps.

Thanks,

-- 

Stephan Deibel
Wingware | Python IDE
Advancing Software Development

www.wingware.com



More information about the wingide-users mailing list