This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: exec() doesn't take an open file
Type: Stage:
Components: Interpreter Core Versions: Python 3.0
process
Status: closed Resolution: duplicate
Dependencies: Superseder:
Assigned To: Nosy List: brett.cannon, nnorwitz
Priority: normal Keywords:

Created on 2007-08-12 17:12 by nnorwitz, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg32628 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2007-08-12 17:12
exec() is documented to take an open file.  The error message also says it takes one, however:

>>> exec(open('nn.py'))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: exec() arg 1 must be a string, file, or code object, not TextIOWrapper
msg32629 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2007-08-12 19:16
This is a duplicate of bug #1762972 which Guido and I have already discussed how to deal with this.
History
Date User Action Args
2022-04-11 14:56:25adminsetgithub: 45301
2008-01-06 22:29:46adminsetkeywords: - py3k
versions: + Python 3.0
2007-08-12 17:12:04nnorwitzcreate