[Tutor] Swampy: No module name World , (Steven D'Aprano)(Dave Angel)(Alan Gauld)
Charles Agriesti
dragriesti at comcast.net
Tue Jun 3 01:08:58 CEST 2014
Thank you very much for the kind replies.
apologies for the html being on. Apparently Thunderbird turns it back on
when it updates. Should be off now.
swampy does contain __init__.py it is completely blank
sampy also contains __init__.pyc that does contain a couple of lines
ending with:
C:\Python27\Lib\site-packages\swampy\__init__.pyt <module> s
sys.path in python2 is
['', 'C:\\Python27\\Lib\\idlelib',
'C:\\Windows\\SYSTEM32\\python27.zip', 'C:\\Python27\\DLLs',
'C:\\Python27\\lib', 'C:\\Python27\\lib\\plat-win',
'C:\\Python27\\lib\\lib-tk', 'C:\\Python27',
'C:\\Python27\\lib\\site-packages']
thanks, I did not know that existed.
What is Swampy?
It uses Tkinter for gui exercises.
http://www.greenteapress.com/thinkpython/swampy/
Module written by Allen Downey to accompany the text 'Think Python'
http://www.greenteapress.com/thinkpython
and necessary for several sections in the book.
Apologies for not explaining this initially.
Note, 'Think Python' uses Python2, but this computer has both 2 and 3 on
it.
They were both working, scripts finding python from any directory, with
nothing entered in the win sys Path as long as only one version of
python was open at a time. After this problem started I amended the
system path
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program
Files (x86)\ATI
Technologies\ATI.ACE\Core-Static;C:\Python27;C:\python27\scripts
adding those last two items. Made a diff for running from console
(powershell, actually) but was not needed for using "run module" in Idle.
Python3 still works just fine with nothing mentioning it in the path.
Location of World module: C:\Python27\Lib\site-packages\swampy\World.py
(there is also a compiled file: World.pyc)
Swampy modules come up okay as long as the script requesting it is in
the Python27 folder. I normally run them from the desktop instead to
make it easy to get all of them deleted or stored.
So:
C:\Python27\my_script.py world.mainloop() works
also from swampy.World import World works
C:\Users\Charles\Desktop\practice_folder\my_script.py
swampy.World import World does not work
error message today is
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
from swampy import World
EOFError: EOF read where object expected
yesterday I was getting a different error, cannot seem to get it
to do the same thing today. Yesterday it said there was no module
named 'World'.
>
More information about the Tutor
mailing list