execfile python3k

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Odys

    execfile python3k

    Hi there,

    Since execfile() is removed in Python 3.0
    I have question about using exec.

    I know about
    exec(open('file name').read())
    but from documentation the 1st arg of exec can be 'file object'.
    However
    exec(open('file name'))
    does not work.
    Does anybody have idea how to construct 'file object' then?

    Thanks,
  • Christian Heimes

    #2
    Re: execfile python3k

    Odys schrieb:
    Hi there,
    >
    Since execfile() is removed in Python 3.0
    I have question about using exec.
    >
    I know about
    exec(open('file name').read())
    but from documentation the 1st arg of exec can be 'file object'.
    However
    exec(open('file name'))
    does not work.
    Does anybody have idea how to construct 'file object' then?
    It's a know bug in Python 3.0.

    Christian

    Comment

    Working...