execfile and import not working

nopsidy nopsidy at gmail.com
Wed Sep 6 08:31:05 EDT 2017


https://www.youtube.com/watch?v=pNe1wWeaHOU&list=PLYI8318YYdkCsZ7dsYV01n6TZhXA6Wf9i&index=1


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



More information about the Python-list mailing list