[wingide-users] MacOSX 10.4: Twisted in WingIDE

Scott Syms scottsyms at gmail.com
Sun Sep 23 18:23:04 MDT 2007


Hi, no joy-

I've tried this under 3.x now.

I can run the line

from twisted.internet.protocol import Factory, Protocol

from python started from a terminal and the Wing Python shell.  If I  
include this line in a script, I get an ImportError complaining that  
there's no module called internet.protocol

PYTHONPATH-

As for pythonpath, in my python shell in wing i have:
['',
  '/Applications/WingIDE.app/Contents/MacOS/src/debug/tserver',
  '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ 
python23.zip',
  '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ 
python2.3',
  '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ 
python2.3/plat-darwin',
  '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ 
python2.3/plat-mac',
  '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ 
python2.3/plat-mac/lib-scriptpackages',
  '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ 
python2.3/lib-tk',
  '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ 
python2.3/lib-dynload',
  '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ 
python2.3/site-packages',
  '/System/Library/Frameworks/Python.framework/Versions/2.3/Extras/ 
lib/python',
  '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ 
python2.3/site-packages']

Echoed from my script I've got:

['/Users/scottsyms/development/scratch',
  '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ 
python23.zip',
  '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ 
python2.3',
  '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ 
python2.3/plat-darwin',
  '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ 
python2.3/plat-mac',
  '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ 
python2.3/plat-mac/lib-scriptpackages',
  '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ 
python2.3/lib-tk',
  '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ 
python2.3/lib-dynload',
  '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ 
python2.3/site-packages',
  '/System/Library/Frameworks/Python.framework/Versions/2.3/Extras/ 
lib/python',
  '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ 
python2.3/site-packages']

I'm thinking this is a bug. Anything to suggest?

tks

S


On 20-Sep-07, at 11:44 PM, Wingware Support wrote:

> 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