question on the compile built in function. Filename ignored?

Alex at
Wed Apr 30 18:01:07 CEST 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,


More information about the Python-list mailing list