Re: Common objects for CLI commands with Typer

2024-09-23 Thread Dan Sommers via Python-list
On 2024-09-23 at 19:00:10 +0100, Barry Scott wrote: > > On 21 Sep 2024, at 11:40, Dan Sommers via Python-list > > wrote: > But once your code gets big the disciple of using classes helps > maintenance. Code with lots of globals is problematic. Even before your code gets big, discipline helps

Re: Common objects for CLI commands with Typer

2024-09-23 Thread Barry Scott via Python-list
> On 21 Sep 2024, at 11:40, Dan Sommers via Python-list > wrote: > > Despite the fact that "everything is an object" in Python, you don't > have to put data or functions inside classes or objects. I also know > nothing about Typer, but there's nothing wrong with functions in a > module. Pyt

Re: Common objects for CLI commands with Typer

2024-09-21 Thread Dan Sommers via Python-list
On 2024-09-21 at 06:38:05 +0100, Barry via Python-list wrote: > > On 20 Sep 2024, at 21:01, Loris Bennett via Python-list > > wrote: > > > > Hi, > > > > Apologies if the following description is to brief - I can expand if no > > one knows what I'm on about, but maybe a short description is e

Re: Common objects for CLI commands with Typer

2024-09-20 Thread Barry via Python-list
> On 20 Sep 2024, at 21:01, Loris Bennett via Python-list > wrote: > > Hi, > > Apologies if the following description is to brief - I can expand if no > one knows what I'm on about, but maybe a short description is enough. > > I am developing a command line application using Typer. Most co

Common objects for CLI commands with Typer

2024-09-20 Thread Loris Bennett via Python-list
Hi, Apologies if the following description is to brief - I can expand if no one knows what I'm on about, but maybe a short description is enough. I am developing a command line application using Typer. Most commands need to do something in a database and also do LDAP stuff. Currently each comma

Re: CLI parsing—with `--help` text—`--foo bar`, how to give additional parameters to `bar`?

2020-10-16 Thread Mats Wichmann
On 10/15/20 5:09 PM, Samuel Marks wrote: > Yes it’s my module, and I’ve been using argparse > https://github.com/SamuelMarks/ml-params > > No library I’ve found provides a solution to CLI argument parsing for my > use-case. > > So I’ll write one. But what should it look li

Re: CLI parsing—with `--help` text—`--foo bar`, how to give additional parameters to `bar`?

2020-10-16 Thread Samuel Marks
cleanly) Also there is a project which takes your CLI and turns it into a GUI (Gooey). At some future point doctrans will be “complete”, and then you can provide inputs via: - CLI arguments - Config file - RPC* - REST* *TODO, will also optionally generate ORM classes for persistence On Fri, 16

Re: Re: CLI parsing—with `--help` text—`--foo bar`, how to give additional parameters to `bar`?

2020-10-15 Thread Samuel Marks
ve been using argparse > >https://github.com/SamuelMarks/ml-params > > > >No library I’ve found provides a solution to CLI argument parsing for my > >use-case. > > Do you know that with `argparse` you can specify how many arguments an option > expects? Thus, it sh

Re: Re: CLI parsing—with `--help` text—`--foo bar`, how to give additional parameters to `bar`?

2020-10-15 Thread Dieter Maurer
Samuel Marks wrote at 2020-10-16 10:09 +1100: >Yes it’s my module, and I’ve been using argparse >https://github.com/SamuelMarks/ml-params > >No library I’ve found provides a solution to CLI argument parsing for my >use-case. Do you know that with `argparse` you can specify how ma

Re: CLI parsing—with `--help` text—`--foo bar`, how to give additional parameters to `bar`?

2020-10-15 Thread 2QdxY4RzWzUUiLuE
On 2020-10-16 at 11:27:56 +1100, Regarding "Re: CLI parsing—with `--help` text—`--foo bar`, how to give additional parameters to `bar`?," Samuel Marks wrote: > The feature that existing CLI parsers are missing is a clean syntax > for specifying options on the second param

Re: CLI parsing—with `--help` text—`--foo bar`, how to give additional parameters to `bar`?

2020-10-15 Thread Cameron Simpson
On 16Oct2020 10:59, Samuel Marks wrote: >--optimizer Adam,learning_rate=0.01,something_else=3 > >That syntax isn’t so bad! =] > >How would you suggest the help text for this looks? (don’t worry about >implementation, just what goes to stdout/stderr) Maybe: Usage: ... ..

Re: CLI parsing—with `--help` text—`--foo bar`, how to give additional parameters to `bar`?

2020-10-15 Thread Samuel Marks
Hi Dan, The feature that existing CLI parsers are missing is a clean syntax for specifying options on the second parameter (the "value"), where there may be different options available depending on which you choose. For example: https://www.tensorflow.org/api_docs/python/tf/keras/optim

Re: CLI parsing—with `--help` text—`--foo bar`, how to give additional parameters to `bar`?

2020-10-15 Thread 2QdxY4RzWzUUiLuE
On 2020-10-16 at 10:20:40 +1100, Cameron Simpson wrote: > On 16Oct2020 10:09, Samuel Marks wrote: > >Yes it’s my module, and I’ve been using argparse > >https://github.com/SamuelMarks/ml-params > > > >No library I’ve found provides a solution to CLI argument parsing

Re: CLI parsing—with `--help` text—`--foo bar`, how to give additional parameters to `bar`?

2020-10-15 Thread 2QdxY4RzWzUUiLuE
On 2020-10-16 at 10:59:16 +1100, Samuel Marks wrote: > --optimizer Adam,learning_rate=0.01,something_else=3 > > That syntax isn’t so bad! =] > > How would you suggest the help text for this looks? (don’t worry about > implementation, just what goes to stdout/stderr) --optimizer name[,optio

Re: CLI parsing—with `--help` text—`--foo bar`, how to give additional parameters to `bar`?

2020-10-15 Thread Karen Shaeffer via Python-list
r to support your needs. Karen > On Oct 15, 2020, at 4:09 PM, Samuel Marks wrote: > > Yes it’s my module, and I’ve been using argparse > https://github.com/SamuelMarks/ml-params > <https://github.com/SamuelMarks/ml-params> > > No library I’ve found provides a soluti

Re: CLI parsing—with `--help` text—`--foo bar`, how to give additional parameters to `bar`?

2020-10-15 Thread Samuel Marks
--optimizer Adam,learning_rate=0.01,something_else=3 That syntax isn’t so bad! =] How would you suggest the help text for this looks? (don’t worry about implementation, just what goes to stdout/stderr) PS: Yeah I used square brackets for my Bash arrays On Fri, 16 Oct 2020 at 10:26 am, Cameron S

Re: CLI parsing—with `--help` text—`--foo bar`, how to give additional parameters to `bar`?

2020-10-15 Thread Cameron Simpson
One other thing: On 15Oct2020 20:53, Samuel Marks wrote: >Idea: preprocess `sys.argv` so that this syntax would work >`--optimizer Adam[learning_rate=0.01]`* > >*square rather than round so as not to require escape characters or >quoting in `sh` Square brackets are also shell syntax, introducing

Re: CLI parsing—with `--help` text—`--foo bar`, how to give additional parameters to `bar`?

2020-10-15 Thread Cameron Simpson
On 16Oct2020 10:09, Samuel Marks wrote: >Yes it’s my module, and I’ve been using argparse >https://github.com/SamuelMarks/ml-params > >No library I’ve found provides a solution to CLI argument parsing for my >use-case. > >So I’ll write one. But what should it look li

Re: CLI parsing—with `--help` text—`--foo bar`, how to give additional parameters to `bar`?

2020-10-15 Thread Samuel Marks
Yes it’s my module, and I’ve been using argparse https://github.com/SamuelMarks/ml-params No library I’ve found provides a solution to CLI argument parsing for my use-case. So I’ll write one. But what should it look like, syntactically and semantically? On Fri, 16 Oct 2020 at 3:14 am, Dieter

Re: CLI parsing—with `--help` text—`--foo bar`, how to give additional parameters to `bar`?

2020-10-15 Thread Dieter Maurer
Samuel Marks wrote at 2020-10-15 20:53 +1100: > ... >To illustrate the issue, using `ml-params` and ml-params-tensorflow: > ... >What's the right solution here? While Python provides several modules in its standard library to process parameters (e.g. the simple `getopt` and the flexible `argparse`

CLI parsing—with `--help` text—`--foo bar`, how to give additional parameters to `bar`?

2020-10-15 Thread Samuel Marks
Previously I have solved related problems with explicit `-}` and `-{` (or `-b`) as in `nginxctl`: ``` $ python -m nginxctl serve --temp_dir '/tmp' \ -b 'server' \ --server_name 'localhost' --listen '8080' \ -b location '/' \ --root '/tmp/wwwro

The '-c' CLI option removes just the command str.

2020-05-05 Thread Simon Forman via Python-list
Is this anything? When you run a python command from the shell to just print the command line args you get this: $ python -c "import sys; print(sys.argv)" ['-c'] But I would expect one of these: Either the '-c' option consumes both args: $ python -c "import sys; print(sys.argv)"

Re: Linux/Windows GUI programming: GUI-fy a CLI using pyInstaller

2018-01-06 Thread Bob Martin
in 788357 20180105 132921 Kevin Walzer wrote: >On 1/1/18 11:45 AM, X. wrote: >> Ulli Horlacher: >>> I have to transfer a python 2.7 CLI programm into one with a (simple) GUI. >>> The program must run on Linux and Windows and must be compilable with >>>

Re: Linux/Windows GUI programming: GUI-fy a CLI using pyInstaller

2018-01-05 Thread Kevin Walzer
On 1/1/18 11:45 AM, X. wrote: Ulli Horlacher: I have to transfer a python 2.7 CLI programm into one with a (simple) GUI. The program must run on Linux and Windows and must be compilable with pyinstall, because I have to ship a standalone windows.exe Any kind of installer is not acceptable

Why the CLI hang using pyjwt ?

2017-10-12 Thread will
Not sure why the CLI command "pyjwt decode --no-verify ..." will hang at sys.stdin.read() even though I provided all the input. Any ideas on how to work around the problem? $ pyjwt -v pyjwt 1.5.3 $ pyjwt decode --no-verify eyJhbGciOiJIUzI1NiIsInR5cC

Re: pypinfo: CLI to easily view PyPI download statistics via Google's BigQuery.

2017-08-24 Thread ofekmeister
If you ever want to quickly check your package's downloads counts or wish to know more about your users, I'd really recommend this! -- https://mail.python.org/mailman/listinfo/python-list

pypinfo: CLI to easily view PyPI download statistics via Google's BigQuery.

2017-05-29 Thread ofekmeister
https://github.com/ofek/pypinfo -- https://mail.python.org/mailman/listinfo/python-list

[New Release] PyFTPD - an FTP server with GUI and CLI versions

2016-11-01 Thread Demosthenes Koptsis
Hello, i have just released the brand new FTP server based on pyftpdlib, named PyFTPD. You can run it from CLI with PyFTPD-cli.py or if you like GUIs run the PyFTPD.py It is written on PyQT4 and Python 2.7.12 More at https://github.com/demosthenesk/PyFTPD Regards, Dim -- https

[CmdTree] sub-command friendly cli library for python : )

2016-08-30 Thread Kidney Win
Hi there, I'm winkidney:), Recently when I work on a cli auto-generating task, I tryed "click" and "argparse" to handle it. But I have to write a library myself to do this job finally. I wish this library helps you :) Project Github Repo: https://github.com/winkidn

Re: A fun python CLI program for all to enjoy!

2016-05-07 Thread Peter Otten
DFS wrote: > getAddresses.py > > Scrapes addresses from www.usdirectory.com and stores them in a SQLite > database, or writes them to text files for mailing labels, etc > > Now, just by typing 'fast food Taco Bell 10 db all' you can find > out how many Taco Bells are within 10 miles of you, and

Re: A fun python CLI program for all to enjoy!

2016-05-07 Thread alister
On Sat, 07 May 2016 18:24:45 +1200, Gregory Ewing wrote: > DFS wrote: >> Maybe it worked because the last time the file was written to was in a >> for loop, so I got lucky and the files weren't truncated? Don't know. > > It "works" because CPython disposes of objects as soon as they are not > re

Re: A fun python CLI program for all to enjoy!

2016-05-06 Thread Gregory Ewing
DFS wrote: Maybe it worked because the last time the file was written to was in a for loop, so I got lucky and the files weren't truncated? Don't know. It "works" because CPython disposes of objects as soon as they are not referenced anywhere. Other implementations of Python (e.g. Jython, PyPy

Re: A fun python CLI program for all to enjoy!

2016-05-06 Thread Stephen Hansen
On Fri, May 6, 2016, at 04:58 PM, DFS wrote: > Improper f.close didn't seem to affect any of the files my program wrote > - and I checked a lot of them when I was writing the code. To be clear, its not an "improper" f.close. That command is simply not closing the file. Period. "f.close" is how yo

Re: A fun python CLI program for all to enjoy!

2016-05-06 Thread MRAB
On 2016-05-07 00:58, DFS wrote: On 5/6/2016 7:29 PM, Ethan Furman wrote: On 05/06/2016 04:12 PM, DFS wrote: On 5/6/2016 4:30 PM, MRAB wrote: If you don't want to use the 'with' statement, note that closing the file is: f.close() It needs the "()"! I used close() in 1 pla

Re: A fun python CLI program for all to enjoy!

2016-05-06 Thread DFS
On 5/6/2016 7:29 PM, Ethan Furman wrote: On 05/06/2016 04:12 PM, DFS wrote: On 5/6/2016 4:30 PM, MRAB wrote: If you don't want to use the 'with' statement, note that closing the file is: f.close() It needs the "()"! I used close() in 1 place, but close without parens in 2

Re: A fun python CLI program for all to enjoy!

2016-05-06 Thread Ethan Furman
On 05/06/2016 04:12 PM, DFS wrote: On 5/6/2016 4:30 PM, MRAB wrote: If you don't want to use the 'with' statement, note that closing the file is: f.close() It needs the "()"! I used close() in 1 place, but close without parens in 2 other places. So it works either way. Go

Re: A fun python CLI program for all to enjoy!

2016-05-06 Thread DFS
On 5/6/2016 4:30 PM, MRAB wrote: On 2016-05-06 20:10, DFS wrote: getAddresses.py Scrapes addresses from www.usdirectory.com and stores them in a SQLite database, or writes them to text files for mailing labels, etc Now, just by typing 'fast food Taco Bell 10 db all' you can find out how many

Re: A fun python CLI program for all to enjoy!

2016-05-06 Thread MRAB
On 2016-05-06 20:10, DFS wrote: getAddresses.py Scrapes addresses from www.usdirectory.com and stores them in a SQLite database, or writes them to text files for mailing labels, etc Now, just by typing 'fast food Taco Bell 10 db all' you can find out how many Taco Bells are within 10 miles of

A fun python CLI program for all to enjoy!

2016-05-06 Thread DFS
getAddresses.py Scrapes addresses from www.usdirectory.com and stores them in a SQLite database, or writes them to text files for mailing labels, etc Now, just by typing 'fast food Taco Bell 10 db all' you can find out how many Taco Bells are within 10 miles of you, and store all the addres

Re: Conditionals in Python cli with -m oneliner

2016-04-09 Thread Peter Otten
gvim wrote: > Given that this work in a Python 3 repl: > import re txt = "Some random text" if re.search(r"\b\w{4}\b", txt): txt 'Some random text' > > and this works on the command line, printing all lines in logs.txt: > > $ python3 -m oneliner -ne 'line' logs.txt > >

Conditionals in Python cli with -m oneliner

2016-04-09 Thread gvim
Given that this work in a Python 3 repl: import re txt = "Some random text" if re.search(r"\b\w{4}\b", txt): txt 'Some random text' and this works on the command line, printing all lines in logs.txt: $ python3 -m oneliner -ne 'line' logs.txt . why does this fail: $ python3 -m oneli

Re: CLI Arguments That Call Functions?

2015-06-18 Thread Michael Torrie
On 06/18/2015 12:08 PM, Tony the Tiger wrote: > Forgot to add, I don't read or see anything posted from outside of the > groups. Posting from the mailing list here. I assume the nntp gateway is two-way. Unless you're manually blocking message originating in google groups, I don't see why you w

Re: CLI Arguments That Call Functions?

2015-06-18 Thread Ian Kelly
On Thu, Jun 18, 2015 at 11:56 AM, Tony the Tiger wrote: > I would have assumed there would be something built in to the > ArgumentParser, but I can't detect anything that seems to do what I want, > so I wrote the following: [SNIP] > So, is there something already in the Python libs? Do I continu

Re: Clize 3.0b1: An argument parser that draws a CLI from your function sigature

2015-05-13 Thread Yann Kaiser
And... 3.0 is released! :-) Feel free to contact me or reply should you encounter any issues! http://clize.readthedocs.org/en/3.0/releases.html#v3-0 On Mon, 27 Apr 2015 at 02:02 Yann Kaiser wrote: > Hello everyone! > > After a few years in development, I am proud to say Clize is landing its >

Re: Clize 3.0b1: An argument parser that draws a CLI from your function sigature

2015-04-28 Thread Yann Kaiser
On Tue, 28 Apr 2015 at 19:16 Chris Angelico wrote: > On Wed, Apr 29, 2015 at 11:55 AM, Yann Kaiser > wrote: > > I'm aware of the pattern, and I don't really like it, especially because > it > > gets weird when multiple modules are involved. You'd have to import > modules > > because they have a

Re: Clize 3.0b1: An argument parser that draws a CLI from your function sigature

2015-04-28 Thread Yann Kaiser
On Mon, 27 Apr 2015 at 22:30 Ethan Furman wrote: > On 04/28, Chris Angelico wrote: > > > That's a lot of separate pieces. Here's the docstringargs equivalent: > > > > https://github.com/Rosuav/snippets/blob/dsa/snippets.py > > Just for grins, here's that using Scription: > > -- 8< ---

Re: Clize 3.0b1: An argument parser that draws a CLI from your function sigature

2015-04-28 Thread Yann Kaiser
On Mon, 27 Apr 2015 at 17:04 Chris Angelico wrote: > On Mon, Apr 27, 2015 at 7:02 PM, Yann Kaiser > wrote: > > Hello everyone! > > > > After a few years in development, I am proud to say Clize is landing its > > feet again and is now in beta for an upcoming release. > > > > You can try it out us

Re: Clize 3.0b1: An argument parser that draws a CLI from your function sigature

2015-04-28 Thread Yann Kaiser
and make a single module that's more likely to > >> be maintained long-term? No point over-duplicating! > > > > > > Agreed. I'm open to have more maintainers and to take input, but I have > to > > admit that at this stage of development, I'm quite a

Re: Clize 3.0b1: An argument parser that draws a CLI from your function sigature

2015-04-28 Thread Chris Angelico
On Wed, Apr 29, 2015 at 11:55 AM, Yann Kaiser wrote: > I'm aware of the pattern, and I don't really like it, especially because it > gets weird when multiple modules are involved. You'd have to import modules > because they have a side-effect of adding stuff to a list rather than import > things s

Re: Clize 3.0b1: An argument parser that draws a CLI from your function sigature

2015-04-27 Thread Ethan Furman
On 04/28, Chris Angelico wrote: > That's a lot of separate pieces. Here's the docstringargs equivalent: > > https://github.com/Rosuav/snippets/blob/dsa/snippets.py Just for grins, here's that using Scription: -- 8< """Store an

Re: Clize 3.0b1: An argument parser that draws a CLI from your function sigature

2015-04-27 Thread Chris Angelico
; the test suite helps with that). If Clize can implement something comparably simple to what I'm doing in the above examples, I'd be happy to drop docstringargs in favour of it. Basically, I didn't like how argparse code looked: https://github.com/Rosuav/snippets/blob/master/snippet

Re: Clize 3.0b1: An argument parser that draws a CLI from your function sigature

2015-04-27 Thread Chris Angelico
On Mon, Apr 27, 2015 at 7:02 PM, Yann Kaiser wrote: > Hello everyone! > > After a few years in development, I am proud to say Clize is landing its > feet again and is now in beta for an upcoming release. > > You can try it out usingpip install --user clize=3.0b1and you can > browse the doc

Re: Clize 3.0b1: An argument parser that draws a CLI from your function sigature

2015-04-27 Thread Javier
It would be nice if it could automatically generate the python code for 'clizing a function', i.e., from the example in https://clize.readthedocs.org/en/latest/ def hello_world(name=None, no_capitalize=False): ... being able to do clize.generate_py_code(hello_world) which would return somet

Clize 3.0b1: An argument parser that draws a CLI from your function sigature

2015-04-27 Thread Yann Kaiser
Hello everyone! After a few years in development, I am proud to say Clize is landing its feet again and is now in beta for an upcoming release. You can try it out usingpip install --user clize=3.0b1and you can browse the docs athttps://clize.readthedocs.org/ For those who'd like an e

Re: CLI framework using python

2014-10-15 Thread vijnaana bhairava
4 7:46:44 PM UTC+5:30, INADA Naoki wrote: > Click_ is another CLI framework. > > It support multi-level nested command like git and it has some nice utilities. > > I love it's design. > > > > > > > > .. _click: http://click.pocoo.org/3/ > >

Re: CLI framework using python

2014-10-14 Thread Naoki INADA
Click_ is another CLI framework. It support multi-level nested command like git and it has some nice utilities. I love it's design. .. _click: http://click.pocoo.org/3/ — Sent from Mailbox On Tue, Oct 14, 2014 at 10:35 PM, vijnaana bhairava wrote: > Hi Folks, > The requir

Re: CLI framework using python

2014-10-14 Thread Chris Angelico
On Wed, Oct 15, 2014 at 12:33 AM, vijnaana bhairava wrote: > Another question i have is whether it uses argparse? > If so, what value add does PYCLI do? It depends what you mean by "CLI framework". If you simply mean something like hg, where you have subcommands and options an

Re: CLI framework using python

2014-10-14 Thread vijnaana bhairava
Hi Folks, The requirement is to develop a CLI framework in python for a linux router. The suggestions i got is to use PyCli/Cliff. Not sure which would be the right choice! Also, a few APIs are mentioned here: https://pythonhosted.org/pyCLI/#module-cli.app Since i couldn't find any a

Re: CLI framework using python

2014-10-10 Thread Gelonida N
On 10/10/2014 10:43 AM, Rustom Mody wrote: On Thursday, October 9, 2014 9:31:39 PM UTC+5:30, gelonida wrote: For calling commands in a slightly nicer way than os.system / sybprocess.Popen you might look at sh or plumbum https://pypi.python.org/pypi/sh https://pypi.python.org/pypi/plumbum

Re: CLI framework using python

2014-10-10 Thread Jean-Michel Pichavant
- Original Message - > From: vijna...@gmail.com > > Hi, > > I need to develop a python CLI framework. > [snip] > 3. There are other such commands for which i will be using python > scripts. I came across pyCLI, but it doesn't have much > documentatio

Re: CLI framework using python

2014-10-10 Thread Rustom Mody
On Thursday, October 9, 2014 9:31:39 PM UTC+5:30, gelonida wrote: > For calling commands in a slightly nicer way than os.system / > sybprocess.Popen you might look at sh or plumbum > https://pypi.python.org/pypi/sh > https://pypi.python.org/pypi/plumbum Both of these look quite nice! [Im looki

Re: CLI framework using python

2014-10-09 Thread Python UL
On 09-10-14 14:20, vijna...@gmail.com wrote: Hi, I need to develop a python CLI framework. For example if i need to set an ip address in linux: ifconfig eth0 172.16.25.125 I should be able to use python to do the above. 1. The user will execute a python script to which i will pass the

Re: CLI framework using python

2014-10-09 Thread Gelonida N
n Thu, Oct 9, 2014 at 5:50 PM, mailto:vijna...@gmail.com>> wrote: Hi, I need to develop a python CLI framework. For example if i need to set an ip address in linux: ifconfig eth0 172.16.25.125 I should be able to use python to do the above. 1. The user will execu

Re: CLI framework using python

2014-10-09 Thread Unix SA
Hello, Go for Optparse.. Look at below docs on how to use it. http://pymotw.com/2/optparse/ Regards, DJ On Thu, Oct 9, 2014 at 5:50 PM, wrote: > Hi, > > I need to develop a python CLI framework. > > For example if i need to set an ip address in linux: > > ifconfig eth

CLI framework using python

2014-10-09 Thread vijnaana
Hi, I need to develop a python CLI framework. For example if i need to set an ip address in linux: ifconfig eth0 172.16.25.125 I should be able to use python to do the above. 1. The user will execute a python script to which i will pass the params eth0 and ip address (something like

please suggest me best way to learn REST API call with CLI

2014-09-27 Thread Unix SA
Hello, I am intermediate to python and i am familier with OOP, but sometime i lost some where looking at OOP in class and objects :( I am looking at https://github.com/pulp/pulp .. basically it uses okaara to generate CLI and calls API. so for example if i run "pulp-admin -u adm

Re: How to handle calling functions from cli

2012-02-24 Thread Chris Angelico
On Sat, Feb 25, 2012 at 9:16 AM, Rodrick Brown wrote: > m = { 'a': 'checkDisks()', >          'b': 'checkMemSize()', >          'c': 'checkBondInterfaces()' >    } > >    runlist = [ c for c in m.keys() if c not in r.d ] >    for runable in runlist: >        eval(m[runable]) It's a reasonable tec

Re: How to handle calling functions from cli

2012-02-24 Thread Chris Rebert
On Fri, Feb 24, 2012 at 2:16 PM, Rodrick Brown wrote: > I have a bunch of sub routines that run independently to perform various > system checks on my servers. I wanted to get an opinion on the following code > I have about 25 independent checks and I'm adding the ability to disable > certain c

How to handle calling functions from cli

2012-02-24 Thread Rodrick Brown
I have a bunch of sub routines that run independently to perform various system checks on my servers. I wanted to get an opinion on the following code I have about 25 independent checks and I'm adding the ability to disable certain checks that don't apply to certain hosts. m = { 'a': 'checkDis

Re: loops for ffmpeg CLI in python

2009-08-13 Thread Albert Hopkins
On Wed, 2009-08-12 at 11:29 +0200, fakhar Gillani wrote: > > Hi, > > I am a begineer in Python. Actually I am encoding video files with > different bitrates using ffmpeg CLI. I wanted to ask you that how can > I make loops so that I can vary the bitrates in the CLI of ffmpeg

loops for ffmpeg CLI in python

2009-08-13 Thread fakhar Gillani
Hi, I am a begineer in Python. Actually I am encoding video files with different bitrates using ffmpeg CLI. I wanted to ask you that how can I make loops so that I can vary the bitrates in the CLI of ffmpeg?? I want to bulid a loop for the command below where i just want to vary the

Re: Gracefully exiting CLI application

2009-07-28 Thread David
Il Tue, 28 Jul 2009 14:31:56 +0100, Nobody ha scritto: > Killed by what means? > > Ctrl-C sends SIGINT which is converted to a KeyboardInterrupt exception. > This can be caught, or if it's allowed to terminate the process, any exit > handlers registered via atexit.register() will be used. > > Fo

Re: Gracefully exiting CLI application

2009-07-28 Thread Nobody
On Mon, 27 Jul 2009 22:35:01 +0200, David wrote: > I am writing a command line application, and I need to perform some > cleaning on exit even if the process is killed. How can I do that with > python? Killed by what means? Ctrl-C sends SIGINT which is converted to a KeyboardInterrupt exception.

Re: Gracefully exiting CLI application

2009-07-27 Thread Doron Tal
On Tue, Jul 28, 2009 at 12:52 AM, Jan Kaliszewski wrote: > As I wrote, you must use signals. Though sometimes it's a good idea > to combine these two techniques (i.e. signal handlers call sys.exit(), > then sys.exitfunc/or function registered with atexit does the actual > cleaning actions). Ano

Re: Gracefully exiting CLI application

2009-07-27 Thread Jan Kaliszewski
27-07-2009 Ben Finney wrote: David <71da...@libero.it> writes: I am writing a command line application, and I need to perform some cleaning on exit even if the process is killed. How can I do that with python? Write an “exit handler” function, then use ‘atexit.register’ http://docs.python.o

Re: Gracefully exiting CLI application

2009-07-27 Thread Ben Finney
David <71da...@libero.it> writes: > I am writing a command line application, and I need to perform some > cleaning on exit even if the process is killed. How can I do that with > python? Write an “exit handler” function, then use ‘atexit.register’ http://docs.python.org/library/atexit> to registe

Re: Gracefully exiting CLI application

2009-07-27 Thread Jan Kaliszewski
27-07-2009 o 22:35:01 David <71da...@libero.it> wrote: I am writing a command line application, and I need to perform some cleaning on exit even if the process is killed. How can I do that with python? See: http://docs.python.org/library/signal.html Cheers, *j -- Jan Kaliszewski (zuo) --

Gracefully exiting CLI application

2009-07-27 Thread David
Greetings, I am writing a command line application, and I need to perform some cleaning on exit even if the process is killed. How can I do that with python? Thank you. David. -- http://mail.python.org/mailman/listinfo/python-list

Re: looking for a pattern to code logic shared by gui/cli

2009-04-22 Thread norseman
Chris Rebert wrote: On Thu, Apr 16, 2009 at 12:36 PM, Andreas Balogh wrote: Only recently I have started developing code for application providing both a GUI and a command line interface (CLI). Naturally I want to reuse the business logic code for both GUI and CLI interfaces. The problem is to

Re: looking for a pattern to code logic shared by gui/cli

2009-04-16 Thread MRAB
Andreas Balogh wrote: Only recently I have started developing code for application providing both a GUI and a command line interface (CLI). Naturally I want to reuse the business logic code for both GUI and CLI interfaces. The problem is to provide feedback to the GUI on the one hand, to the

Re: looking for a pattern to code logic shared by gui/cli

2009-04-16 Thread Chris Rebert
On Thu, Apr 16, 2009 at 12:36 PM, Andreas Balogh wrote: > Only recently I have started developing code for application providing both > a GUI and a command line interface (CLI). Naturally I want to reuse the > business logic code for both GUI and CLI interfaces. The problem is to

looking for a pattern to code logic shared by gui/cli

2009-04-16 Thread Andreas Balogh
Only recently I have started developing code for application providing both a GUI and a command line interface (CLI). Naturally I want to reuse the business logic code for both GUI and CLI interfaces. The problem is to provide feedback to the GUI on the one hand, to the CLI on the other hand

Re: Code Review request for the trash-cli project

2009-01-06 Thread Steven D'Aprano
On Tue, 06 Jan 2009 17:30:19 +0200, Dotan Cohen wrote: > I don't know about the code, but would there be a reason _not_ to alias > rm, rmdir to this program? I see that it is GPL, so this would be a > great addition to any Linux distro. I sure as hell don't want rm to move files to the trash. If

Re: Code Review request for the trash-cli project

2009-01-06 Thread Andrea Francia
Dotan Cohen wrote: 2009/1/6 Andrea Francia : The trash-cli project is a opensource implementation of the FreeDesktop.org I don't know about the code, but would there be a reason _not_ to alias rm, rmdir to this program? Actually the trash-put command accept all the options of GNU

Re: Code Review request for the trash-cli project

2009-01-06 Thread Dotan Cohen
2009/1/6 Andrea Francia : > The trash-cli project is a opensource implementation of the FreeDesktop.org > Trash Specification that provides a command line interface to manage the > trashcan. > > It's provide the following commands: > * trash-put trashes files and

Code Review request for the trash-cli project

2009-01-06 Thread Andrea Francia
The trash-cli project is a opensource implementation of the FreeDesktop.org Trash Specification that provides a command line interface to manage the trashcan. It's provide the following commands: * trash-put trashes files and directories. * trash-empty empty the trash

Re: cli user interface ala cisco IOS or JUNOS

2007-04-03 Thread phil . aerts . tln
On 3 apr, 11:57, Ben Finney <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] writes: > > for one of mypythonprojects I need an user interface similar to that > > of cisco IOS or even better JuniperJUNOS. > > Does anyone know of existingpythonmodules that gives this kind of > > functionality? > > I su

Re: cli user interface ala cisco IOS or JUNOS

2007-04-03 Thread Ben Finney
[EMAIL PROTECTED] writes: > for one of my python projects I need an user interface similar to that > of cisco IOS or even better Juniper JUNOS. > Does anyone know of existing python modules that gives this kind of > functionality? I suspect you've not checked the standard library index: Pyth

cli user interface ala cisco IOS or JUNOS

2007-04-03 Thread phil . aerts . tln
Hi, for one of my python projects I need an user interface similar to that of cisco IOS or even better Juniper JUNOS. Does anyone know of existing python modules that gives this kind of functionality ? -P -- http://mail.python.org/mailman/listinfo/python-list

Re: CLI

2006-02-09 Thread Carl Cerecke
mwt wrote: > I want to do programmatic terminal commands on unix with python - i.e. > I want my program to issue commands to start and stop scripts, other > programs, etc. I'm sure this must be fairly straightforward, but > haven't been able to find a reference for it. Any help? > Try: pexpect.s

Re: CLI

2006-02-09 Thread Rene Pijlman
mwt: >I want to do programmatic terminal commands on unix with python - i.e. >I want my program to issue commands to start and stop scripts, other >programs, etc. I'm sure this must be fairly straightforward, but >haven't been able to find a reference for it. Any help? http://www.python.org/doc/2.

Re: CLI

2006-02-09 Thread Sybren Stuvel
mwt enlightened us with: > I want to do programmatic terminal commands on unix with python If you want to use a real terminal, search for pty. If you just want to start and stop scripts, check the popen2 module. Sybren -- The problem with the world is stupidity. Not saying there should be a cap

CLI

2006-02-09 Thread mwt
I want to do programmatic terminal commands on unix with python - i.e. I want my program to issue commands to start and stop scripts, other programs, etc. I'm sure this must be fairly straightforward, but haven't been able to find a reference for it. Any help? -- http://mail.python.org/mailman/li

Re: epydoc CLI and many files

2005-09-07 Thread Dave Benjamin
Terry Hancock wrote: > On Monday 05 September 2005 08:10 am, Laszlo Zsolt Nagy wrote: > >>The problem is that now I have so many modules that the shell (cmd.exe) >>cannot interpret this as a one command. > > In POSIX systems, the shell expands wildcards into multiple files on > the command line

Re: epydoc CLI and many files

2005-09-07 Thread Terry Hancock
On Monday 05 September 2005 08:10 am, Laszlo Zsolt Nagy wrote: > I have a problem under Windows. There's your problem. ;-) > I use the cli.py program included with > epydoc. I wrote a small program that lists all of my modules after the > cli. Something like this: &g

Re: epydoc CLI and many files

2005-09-05 Thread Sybren Stuvel
Laszlo Zsolt Nagy enlightened us with: > I wrote a small program that lists all of my modules after the > cli. Something like this: > > cli.py --html --inheritance=grouped module1.py module2.py module3.py > .. > > The problem is that now I have so many modules that

epydoc CLI and many files

2005-09-05 Thread Laszlo Zsolt Nagy
Hello, I have a problem under Windows. I use the cli.py program included with epydoc. I wrote a small program that lists all of my modules after the cli. Something like this: cli.py --html --inheritance=grouped module1.py module2.py module3.py .. The problem is that now I have so many