[Tutor] Problem with file()

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Sat Aug 21 19:43:52 CEST 2004



On Sat, 21 Aug 2004, Bernard Lebel wrote:

> oExtList = file( sListPath, 'r' )
>
> Traceback (most recent call last):
>   File "<interactive input>", line 1, in ?
>   File "C:\Python23\lib\ClientsManager\__init__.py", line 104, in getextlist
>     oExtList = file( sListPath, 'r' )
> TypeError: this constructor takes no arguments

Hi Bernard,


The error says that it's having a problem calling:

    oExtList = file( sListPath, 'r' )

but there's no such line that I can see in your posted code.


The closest thing I see to is is:

>     oExtList = file( sListPath )

Is it possible that you edited your code before or after getting the error
message?  I don't think the error message is correctly pointing to the
right line.  Are you sure you're posting up the updated code?



Here's one way to get the "this constructor takes no arguments" kind of
error:

###
>>> class Foo:
...     pass
...
>>> Foo(1, 2, 3)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: this constructor takes no arguments
###

So the error is trying to say that a class is being instantiated
incorrectly, but I don't see where yet.


It might help if you attach:

    C:\Python23\lib\ClientsManager\__init__.py

in your next reply; let us check something.


Good luck to you.



More information about the Tutor mailing list