[IronPython] Error Message

xtian wilberforce at gmail.com
Mon Jul 4 10:17:14 CEST 2005

It sounds like both problems are space/tab indenting problems - the
first because line 241 is interpreted as at the block/level of the
class, rather than the method, and the second because the code at line
268 is indented further than the preceding line.

Try turning on visible whitespace in your editor, and make sure you're
not mixing tabs and spaces. CPython interprets a tab as 8 spaces, and
I'd guess that IronPython does the same. If the editor you're using
interprets them differently (say by advancing to the next tab-stop),
you'll get code that looks right in the editor, but has errors like

Configure your editor to insert <however many spaces you want for an
indent level (2, 3 or 4 seem popular)> when you hit tab. I tell
Textpad to insert tabs, but convert all tabs in the file to 4 spaces
on saving. This has the advantage of not having to delete them
one-by-one on an unindent, although you can generally use shift-tab
(or ctrl-[ in IDLE) for that anyway.

(Some people would say that you should only use tabs. But I think
they're dying out - selection pressures seem to favour big, burly
backspace-key-fingers. ;)

Are you already familiar with CPython? It might be good to have a play
with that as well, if you're not - that could help you to work out
whether you're seeing a bug, or standard Python behaviour.

Hope that helps!

On 7/4/05, Shidan <shidan at gmail.com> wrote:
> Hi I'm getting the following message, couldn't find anything similar
> on the bug tracker:
> C:\MontLingua\python>ironpythonconsole MontyLingua.py
> IronPython.Objects.PythonNameError: name 'self' not defined
> at __main__.MontyLingua$maker0() in C:\MontLingua\python\MontyLingua.py:line 241
> at __main__.Initialize() in C:\MontLingua\python\MontyLingua.py:line 157
> ### This is the code :
>  def split_paragraphs(self,text):
>         """inputs a raw text and outputs a list of paragraph segments"""
>         return self.theMontyTokenizer.split_paragraphs(text)
> ##this is line 241
> Am I doing something wrong or is this a bug
> Another message I can't figure out is the following:
> C:\MontLingua\python>ironpythonconsole MontyLingua.py
> IronPython.Objects.PythonSyntaxError: unexpected token <indent> at
> MontyLingua.p
> y:268
> ### Heres the code:
>  def strip_tags(self,tagged_or_chunked_text):
>         toks = tagged_or_chunked_text.split()
>         toks = filter(lambda x:'/' in x,toks)
>         toks = map(lambda x:x.split('/')[0],toks)          ### Line 268
>         return ' '.join(toks)
> Looking forward to learning more about IronPython so thanks in advance.
> -----
> Shidan
> _______________________________________________
> users-ironpython.com mailing list
> users-ironpython.com at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

More information about the Ironpython-users mailing list