Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #70812 > unrolled thread

Running scripts from shell / IDLE in windows

Started bys71murfy <sam.murthy@gmail.com>
First post2014-05-01 08:34 -0700
Last post2014-05-01 11:18 -0500
Articles 3 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  Running scripts from shell / IDLE in windows s71murfy <sam.murthy@gmail.com> - 2014-05-01 08:34 -0700
    Re: Running scripts from shell / IDLE in windows Mark H Harris <harrismh777@gmail.com> - 2014-05-01 11:02 -0500
      Re: Running scripts from shell / IDLE in windows Mark H Harris <harrismh777@gmail.com> - 2014-05-01 11:18 -0500

#70812 — Running scripts from shell / IDLE in windows

Froms71murfy <sam.murthy@gmail.com>
Date2014-05-01 08:34 -0700
SubjectRunning scripts from shell / IDLE in windows
Message-ID<9fa954ea-e341-42ac-a91d-fb25598ccba7@googlegroups.com>
Hi:

I am trying to run the simple helloworld script from the IDLE shell. I want to pass it arguments. Please can you give me the syntax to do it?

Thanks, Sam

[toc] | [next] | [standalone]


#70813

FromMark H Harris <harrismh777@gmail.com>
Date2014-05-01 11:02 -0500
Message-ID<53627022.9020504@gmail.com>
In reply to#70812
On 5/1/14 10:34 AM, s71murfy wrote:

>
> I am trying to run the simple helloworld script from the IDLE shell. I want to pass it arguments. Please can you give me the syntax to do it?
>

There are several ways to do this, depending on your preferences and 
goals.  Is the helloworld script the tk version?  In which case have the 
script put up input dialog boxes...

The python docs pages are very clear about input parameter i/o and may 
give you some help, if you're building a script that you want to launch 
from a terminal, or startup...

What I do with my IDLE scripts is embed to embed a Main function (or 
call it Hello().  So, I import hello, then call hello.Main(parms).  or, 
  hello.Hello(parms)

example

====file hello.py===

def Hello(parms list):
     whatever
     whatever

====================


 From IDLE:

import hello

hello.Hello([1, 2, 3, 4])




marcus

[toc] | [prev] | [next] | [standalone]


#70814

FromMark H Harris <harrismh777@gmail.com>
Date2014-05-01 11:18 -0500
Message-ID<ljts4h$bpt$1@speranza.aioe.org>
In reply to#70813
On 5/1/14 11:02 AM, Mark H Harris wrote:
> ====file hello.py===
>
> def Hello(parms list):
>      whatever
>      whatever
>
> ====================
>
>
>  From IDLE:
>
> import hello
>
> hello.Hello([1, 2, 3, 4])

Sorry, almost forgot, if you 'run' the module hello.py (with the IDLE 
run dropdown) then the 'hello' name will not be in the namespace... just 
enter:

Hello(parms)

Here is another example:

===hello.py===

def Hello(myname):
     out = "hello, " + str(myname)
     print(out)

==============


import hello
hello.Hello("mark")

hello, mark


[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web