Hi Troels,

This is not quite complete - the problem here is the user function
intro flag.  It should be turned on for the script so you see the
"relax>" messages, and then turned off again for the prompt so that
the user function text and "relax>" is not printed out twice.  I have
a suggested patch below, feel free to make a similar change.  Try this
yourself in a script with a single line "pipe.create('test', 'mf')",
and run this with the -p option.

Regards,

Edward


P. S.  Here is the suggestion:


Index: prompt/interpreter.py
===================================================================
--- prompt/interpreter.py       (revision 22189)
+++ prompt/interpreter.py       (working copy)
@@ -276,7 +276,16 @@

         # Execute the script and go into prompt if the interactive
flag -p --prompt is given at startup.
         if script_file and status.prompt:
+            # Turn on the user function intro flag.
+            status.uf_intro = True
+
+            # Run the script.
             run_script(intro=self.__intro_string, local=locals(),
script_file=script_file, show_script=self.__show_script,
raise_relax_error=self.__raise_relax_error)
+
+            # Turn off the user function intro flag.
+            status.uf_intro = False
+
+            # Go to the prompt.
             prompt(intro=None, local=locals())

         # Go to the prompt.



On 14 February 2014 12:13,  <[email protected]> wrote:
> Author: tlinnet
> Date: Fri Feb 14 12:13:05 2014
> New Revision: 22187
>
> URL: http://svn.gna.org/viewcvs/relax?rev=22187&view=rev
> Log:
> Finished implementing the functionality of interacting with variables after 
> executing a script.
>
> Fix for sr #3117, (https://gna.org/support/?3117) - Functionality to inspect 
> interactively after running script - The equivalence to python -i
>
> For getting access to variables after executing a script, the variable should 
> be saved under: cdp.X, where X define a container.
> The name space issue is discussed in: 
> http://thread.gmane.org/gmane.science.nmr.relax.devel/5012
>
> Modified:
>     trunk/prompt/interpreter.py
>
> Modified: trunk/prompt/interpreter.py
> URL: 
> http://svn.gna.org/viewcvs/relax/trunk/prompt/interpreter.py?rev=22187&r1=22186&r2=22187&view=diff
> ==============================================================================
> --- trunk/prompt/interpreter.py (original)
> +++ trunk/prompt/interpreter.py Fri Feb 14 12:13:05 2014
> @@ -266,12 +266,17 @@
>              readline.parse_and_bind("tab: complete")
>
>          # Execute the script file if given.
> -        if script_file:
> +        if script_file and not status.prompt:
>              # Turn on the user function intro flag.
>              status.uf_intro = True
>
>              # Run the script.
>              return run_script(intro=self.__intro_string, local=locals(), 
> script_file=script_file, show_script=self.__show_script, 
> raise_relax_error=self.__raise_relax_error)
> +
> +        # Execute the script and go into prompt if the interactive flag -p 
> --prompt is given at startup.
> +        if script_file and status.prompt:
> +            run_script(intro=self.__intro_string, local=locals(), 
> script_file=script_file, show_script=self.__show_script, 
> raise_relax_error=self.__raise_relax_error)
> +            prompt(intro=None, local=locals())
>
>          # Go to the prompt.
>          else:
>
>
> _______________________________________________
> relax (http://www.nmr-relax.com)
>
> This is the relax-commits mailing list
> [email protected]
>
> To unsubscribe from this list, get a password
> reminder, or change your subscription options,
> visit the list information page at
> https://mail.gna.org/listinfo/relax-commits

_______________________________________________
relax (http://www.nmr-relax.com)

This is the relax-devel mailing list
[email protected]

To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-devel

Reply via email to