[Edu-sig] Version 0.2.03 of PataPata released (adds Jython/Swing support)

Paul D. Fernhout pdfernhout at kurtz-fernhout.com
Wed Aug 9 15:36:57 CEST 2006


Andreas-

Looking more into this issue (and based on testing feedback here) I see a 
couple if things:

That the tokenize.py module has been under recent development:
http://sourceforge.net/tracker/index.php?func=detail&aid=1224621&group_id=5470&atid=105470http://sourceforge.net/tracker/index.php?func=detail&aid=1224621&group_id=5470&atid=105470
[ 1224621 ] tokenize module does not detect inconsistent dedents
from:
   http://www.mail-archive.com/pudge@lesscode.org/msg00050.html

The source versions for tokenize.py are at:
   http://svn.python.org/view/python/trunk/Lib/tokenize.py
Though it looks like only minor changes in the latest version.
And the version before that introduced this test.

Looking carefully in WorldCommonTK.py, there are two lines in the file in 
that class ( SimpleSequenceLayoutManager) which have extra space at the 
end before the carriage return. I think that is perfectly legal Python 
(though sloppy of me perhaps) but I'm wondering if the specific version 
(2.4.3) of Python you are using has a bug in the tokenizer.py in handling it?

So, a few more things to try based on previous tests (thanks to people who 
tested):

So you could remove trailing space on these two lines:
Line 834:
width = panel.width - panel.borderwidth * 2 - self.sidePadding * 2
Line 859:
lengthUsed += self.betweenMorphSpacing * (len(visibleMorphs) - 1)
And see if that makes a difference.

You could also modify tokenize.py on your machine to generate a better 
exception with a line number where the error is. I haven't tried this, but 
something like:
   raise IndentationError(
                         "unindent does not match any outer indentation 
level")
would become something like:
   raise IndentationError("unindent does not match any outer indentation 
level around line %d" % lnum)
That would at least help pinpoint the textual line tokenize.py does not like.

Just to get running under Windows, if there was another later windows 
installer for 2.4, you could try upgrading to Python 2.4.4 (the Python 2.4 
I have on my Debian machine is 2.4.4c though I don't use it by default, 
which apparently also works with the code according to my own testing). 
However, looks like the Windows installer from the Python site is only 2.4.3.
   http://www.python.org/download/releases/
You could try 2.5 beta maybe? Or downgrade to Python 2.3.5? Or install 
them side by side? But I'm not sure how much trouble having two Pythons 
installed under Windows might get you into, or what else might go wrong 
with different versions. But even if that worked for you, that isn't a 
great solution, as it means anyone using the latest Windows installer is 
out of luck.

Anyway, I'll keep looking at other possibilities too.

--Paul Fernhout

Andreas Raab wrote:
> Hi Paul -
> 
> When I try to run 0.2.3 (Python 2.4 on Windows XP) all I get is an 
> indentation error (stack dump below). Any ideas?
> 
> Cheers,
>    - Andreas
> 
> ---------------------------------------------------------------------
> 
> PataPata Version 0.2.03
> Using 'Alt' as the meta key to drag Morphs and get menus
> You can change this key in the file "options.py"
> If you use ALT under GNU/Linux and it drags windows instead of morphs,
> then you need to change a setting in your desktop settings.
> Loading world file: WorldExampleTK.py from C:\PataPata_v203\PataPata_v203
> Loading world file: WorldCommonTK.py from C:\PataPata_v203\PataPata_v203
> Traceback (most recent call last):
>    File "PataPata.py", line 18, in ?
>      PataPataViewerTK.main()
>    File "C:\PataPata_v203\PataPata_v203\PataPataViewerTK.py", line 24, 
> in main
>      world = PrototypeClass(None).newPrototypeFromFile("WorldExampleTK.py")
>    File "C:\PataPata_v203\PataPata_v203\Prototypes.py", line 514, in 
> newPrototypeFromFile
>      newPrototype = worldModule.define_prototype(self.world)
>    File "C:\PataPata_v203\PataPata_v203\WorldExampleTK.py", line 9, in 
> define_prototype
>      world.worldLibraries = [world.newWorldFromFile("WorldCommonTK.py")]
>    File "C:\PataPata_v203\PataPata_v203\Prototypes.py", line 522, in 
> newWorldFromFile
>      result = newWorld.newPrototypeFromFile(fileName)
>    File "C:\PataPata_v203\PataPata_v203\Prototypes.py", line 514, in 
> newPrototypeFromFile
>      newPrototype = worldModule.define_prototype(self.world)
>    File "C:\PataPata_v203\PataPata_v203\WorldCommonTK.py", line 794, in 
> define_prototype
>      class SimpleSequenceLayoutManager:
>    File "C:\PataPata_v203\PataPata_v203\Prototypes.py", line 641, in 
> buildPrototype
>      prototype.setAttributeWithoutSideEffects(propertyName, value)
>    File "C:\PataPata_v203\PataPata_v203\Prototypes.py", line 576, in 
> setAttributeWithoutSideEffects
>      value = PrototypeMethod(self, value)
>    File "C:\PataPata_v203\PataPata_v203\Prototypes.py", line 47, in __init__
>      source = inspect.getsource(function)
>    File "C:\Python24\Lib\inspect.py", line 563, in getsource
>      lines, lnum = getsourcelines(object)
>    File "C:\Python24\Lib\inspect.py", line 555, in getsourcelines
>      else: return getblock(lines[lnum:]), lnum + 1
>    File "C:\Python24\Lib\inspect.py", line 538, in getblock
>      tokenize.tokenize(ListReader(lines).readline, BlockFinder().tokeneater)
>    File "C:\Python24\Lib\tokenize.py", line 153, in tokenize
>      tokenize_loop(readline, tokeneater)
>    File "C:\Python24\Lib\tokenize.py", line 159, in tokenize_loop
>      for token_info in generate_tokens(readline):
>    File "C:\Python24\Lib\tokenize.py", line 229, in generate_tokens
>      raise IndentationError(
> IndentationError: unindent does not match any outer indentation level


More information about the Edu-sig mailing list