[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

execfile and import not working


On Wed, Sep 6, 2017 at 6:57 PM, Stefan Ram <ram at zedat.fu-berlin.de> wrote:
> Friedrich Rentsch <anthra.norell at bluewin.ch> writes:
>>ready to go. Alas, execfile and import commands don't do my bidding, but
>>hang IDLE. All I can do is kill the process named "python" from a bash
>   AFAIK ?exefile( 'myscr.py' )? is
> exec( compile( open( 'myscr.py', 'rb' ).read(), 'myscr.py', 'exec' ))
>   (at least, that line is reported to work in Python 3).
>   Now you can do each step in isolation (untested):
> a = open( 'myscr.py', 'rb' )
> b = a.read()
> c = compile( b, 'myscr.py', 'exec' )
> d = exec( c )
>   to find the step where it hangs. Then maybe you can do this
>   analysis recursively with this step until you have found the
>   exact elementary statement or expression where it hangs.
> --
> https://mail.python.org/mailman/listinfo/python-list