Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Creating interactive command-line Python app?

Reply
Thread Tools

Creating interactive command-line Python app?

 
 
planetthoughtful
Guest
Posts: n/a
 
      12-21-2005
Hello All,

Newbie to Python, and I'm wondering if it's possible to create a Python
console app that prompts for further input on the command line when run
(in Windows XP, if that's important)?

I've tried Googling, but the results are overwhelmingly about
interactive Python environments (IPython etc etc), instead of how to
achieve prompting at the command line when running your own Python app.

Any help appreciated!

Much warmth,

planetthoughtful

 
Reply With Quote
 
 
 
 
Steve Holden
Guest
Posts: n/a
 
      12-21-2005
planetthoughtful wrote:
> Hello All,
>
> Newbie to Python, and I'm wondering if it's possible to create a Python
> console app that prompts for further input on the command line when run
> (in Windows XP, if that's important)?
>
> I've tried Googling, but the results are overwhelmingly about
> interactive Python environments (IPython etc etc), instead of how to
> achieve prompting at the command line when running your own Python app.
>
> Any help appreciated!
>
> Much warmth,
>
> planetthoughtful
>

Yes. Look at the raw_input() function:

>>> result = raw_input("What can I do for you? ")

What can I do for you? Something
>>> result

'Something'
>>>


regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC www.holdenweb.com
PyCon TX 2006 www.python.org/pycon/

 
Reply With Quote
 
 
 
 
keirr
Guest
Posts: n/a
 
      12-21-2005
You may also find the cmd module useful, see:
http://docs.python.org/lib/module-cmd.html

Cheers,

Keir.

 
Reply With Quote
 
bob.blanchett
Guest
Posts: n/a
 
      01-03-2013
This is exactly what you want:

https://cliff.readthedocs.org/en/latest/

Bob/Julius Flywheel

On Wednesday, December 21, 2005 11:34:38 PM UTC+11, planetthoughtful wrote:
> Hello All,
>
> Newbie to Python, and I'm wondering if it's possible to create a Python
> console app that prompts for further input on the command line when run
> (in Windows XP, if that's important)?
>
> I've tried Googling, but the results are overwhelmingly about
> interactive Python environments (IPython etc etc), instead of how to
> achieve prompting at the command line when running your own Python app.
>
> Any help appreciated!
>
> Much warmth,
>
> planetthoughtful

 
Reply With Quote
 
Tim Chase
Guest
Posts: n/a
 
      01-03-2013
(original post from planetthoughtful didn't seem to arrive here, so
replying to Bob's reply)

> Newbie to Python, and I'm wondering if it's possible to create a
> Python console app that prompts for further input on the command
> line when run (in Windows XP, if that's important)?


While Bob's suggestion of "cliff" sounds interesting, Python also
offers the "cmd" module[1] in the standard library which does most
of what I've needed in the past. If you've got the readline library
available, it also supports autocompletion and command-line history
which is a nice bonus.

-tkc

[1]
http://docs.python.org/2/library/cmd.html # py2.x
http://docs.python.org/3/library/cmd.html # py3.x
Docs should be about the same
 
Reply With Quote
 
Dave Angel
Guest
Posts: n/a
 
      01-03-2013
On 01/03/2013 09:24 AM, Tim Chase wrote:
> (original post from planetthoughtful didn't seem to arrive here, so
> replying to Bob's reply)
>
>> Newbie to Python, and I'm wondering if it's possible to create a
>> Python console app that prompts for further input on the command
>> line when run (in Windows XP, if that's important)?

>
> While Bob's suggestion of "cliff" sounds interesting, Python also
> offers the "cmd" module[1] in the standard library which does most of
> what I've needed in the past. If you've got the readline library
> available, it also supports autocompletion and command-line history
> which is a nice bonus.
>
> -tkc
>
> [1]
> http://docs.python.org/2/library/cmd.html # py2.x
> http://docs.python.org/3/library/cmd.html # py3.x
> Docs should be about the same


The two replies in 2005 mentioned both raw_input and the cmd module (in
case that's what he was implying). They were posted within 90 minutes
of the original.


http://python.6.n6.nabble.com/Creati...-td910404.html

I assume that cliff is much more recent, and Bob wanted to update the
thread after 7 years.
http://pypi.python.org/pypi/cliff



--

DaveA

 
Reply With Quote
 
Tim Chase
Guest
Posts: n/a
 
      01-03-2013
On 01/03/13 08:41, Dave Angel wrote:
> The two replies in 2005 mentioned both raw_input and the cmd module (in
> case that's what he was implying). They were posted within 90 minutes
> of the original.


Ah. 2005 would explain why my newsreader has purged them as ancient
history Thanks for the clarification.

-tkc





 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Interactive/Non-interactive ASPX ? WJ ASP .Net 2 02-26-2005 02:54 AM
non Interactive and Interactive AAH Computer Support 0 01-09-2005 04:09 PM
Interactive and non interactive AAH Computer Support 1 01-09-2005 04:01 PM
Software for creating interactive diagrams gigajosh Computer Support 4 01-08-2004 10:53 PM
Creating a interactive CD-ROM MadMike42 Computer Support 1 11-03-2003 12:38 AM



Advertisments