execfile return values

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

    execfile return values

    Hello all!
    I've a little and no important question:
    Suppose 2 scripts

    ##ex.py###
    a=execfile('scr .py')
    print "return value: ", a

    ##scr.py###
    print "i'm scr.py"

    Executing that, a takes None value.
    Is there a way to handle the execution of the script ordered by the execfile
    statement??

    Another way that def & return in functions.

    Thanks

    Enrique (Madrid)




    **AVISO DE CONFIDENCIALIDA D**
    La información contenida en este mensaje y archivos es privada y confidencial estando dirigida solamente al destinatario. Si Ud. ha recibido esta información por error, por favor, proceda a su inmediata destrucción. Cualquier opinión o punto de vista contenido en este mensaje corresponde al remitente y necesariamente no representa la opinión del GRUPO XEROX.

  • Terry Reedy

    #2
    Re: execfile return values

    "Enrique" <enrique.palomo @xgs-spain.com> wrote in message
    news:mailman.10 65180983.27200. python-list@python.org ...
    '''
    ##ex.py###
    a=execfile('scr .py')
    print "return value: ", a

    ##scr.py###
    print "i'm scr.py"

    Executing that, a takes None value.
    '''
    As documented in Lib Ref 2.1 Built-in Functions. If you have not read
    the execfile doc, please do, or reread. If you have read (or reread),
    tell us what part you do not understand.
    [color=blue]
    >Is there a way to handle the execution of the script ordered by the[/color]
    execfile statement??

    I do not understand 'handle the execution of'. What you are trying to
    accomplish that did not happen?

    Terry J. Reedy


    Comment

    • Dennis Lee Bieber

      #3
      Re: execfile return values

      Terry Reedy fed this fish to the penguins on Friday 03 October 2003
      07:19 am:
      [color=blue]
      >
      > I do not understand 'handle the execution of'. What you are trying to
      > accomplish that did not happen?
      >[/color]
      At a guess, I'd say he wants 'a' to have the contents of stdout ("i'm
      scr.py").


      --[color=blue]
      > =============== =============== =============== =============== == <
      > wlfraed@ix.netc om.com | Wulfraed Dennis Lee Bieber KD6MOG <
      > wulfraed@dm.net | Bestiaria Support Staff <
      > =============== =============== =============== =============== == <
      > Bestiaria Home Page: http://www.beastie.dm.net/ <
      > Home Page: http://www.dm.net/~wulfraed/ <[/color]

      Comment

      Working...