[Tutor] Command line scripts

David Hutto smokefloat at gmail.com
Sun Jan 9 10:44:29 CET 2011


On Sat, Jan 8, 2011 at 9:10 AM, Alan Gauld <alan.gauld at btinternet.com> wrote:
> "David Hutto" <smokefloat at gmail.com> wrote
>
>> If I use as command line script, is there any disruption in the
>> execution of the code using wxpython.
>
> I don't understand the question.
> wxPython is a GUI toolkit so how would you have a command
> line script using wxPython? Or do you mean running a wxPython
> GUI program from the command line? - that should work just fine.

No. The function below is called on an event within a wxpython app.

The following line is what I mean by calling a command line from within the app
using subprocess.

self.espeak = subprocess.Popen(['espeak', word],stdout =
subprocess.PIPE).communicate()[0]

>
>> In other words, is a command line app different from
>> bindings in a compiled app?
>
> What kind of bindings?

To functions in libraries external to python.

> And what do you mean by a compiled app?

Basically the below.

> Python is interpreted (or actually compiled to byte code
> and the byte code is interpreted - but its the same principle).
> So-called exe generators simply bundle the interpreter witrh
> the code and auto run it.

So it's basically just installing a sandbox version of python?

>
> And wxPython is irrelevant to that debate since it is just
> a set of modules regardless of how you run it.
I was just saying the module I was using for the apps framework


>
>>      @ trace
>>      def play(self, event = None, text = None):
>>              if event == None:
>>                      self.textlist = []
>>                      for item in text.split(' '):
>>                              self.textlist.append(item)
>>                      print self.textlist
>>                      for word in self.textlist:
>>                              self.espeak =
>>                                      subprocess.Popen(['espeak', word],
>> stdout =
>>
>> subprocess.PIPE).communicate()[0]
>>              if event != None:
>>                      self.textlist = []
>>                      for item in self.text2speech.GetValue().split(' '):
>>                              self.textlist.append(item)
>>                      print self.textlist
>>                      for word in self.textlist:
>>                              self.espeak =
>>                                       subprocess.Popen(['espeak', word],
>> stdout =
>>
>> subprocess.PIPE).communicate()[0]
>


> Sorry, I'm missing the significance of this function?

No significance, it was just an example to illustrate my question.
Which ultimately is, if I have a standalone application, that doesn't
come from a command line terminal launching(which I haven't gotten to
yet), is using the command line calls going through subprocess going
to be called without the terminal, or will it open a terminal
automatically to make those calls?

Or will all of my python apps need to have a command line terminal
open to launch them. I haven't went all the way through the distutils
docs, so this might be answered with further reading, but I wanted to
know the answer before I did several basic apps like this. Although
I'll probably still do them for my own personal usage.

>
> Confused,.

I don't exactly ask the most well layed out questions, but I'm working on it.


More information about the Tutor mailing list