question on the compile built in function. Filename ignored?

Alex delete.this.part.alex.news at attbi.com
Wed Apr 30 12:01:07 EDT 2003


I am fairly to new to Python, so please bear with me.

I am trying to use the built in function compile.  The filename argument
seems to be ignored no matter what I try.  According to the docs, it should
be used in the output error message.  Here is a simple example:

Python 2.2.2 (#1, Apr 16 2003, 22:00:16)
[GCC 3.2.1 20021207 (Gentoo Linux 3.2.1-20021207)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> compile(':\n', 'abc', 'exec')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "<string>", line 1
    :
    ^
SyntaxError: invalid syntax


>From the docs I would expect the line 

  File "<string>", line 1

to read

  File "abc", line 1


What am I missing?

Thanks in advance,

Alex






More information about the Python-list mailing list