Newbee question about running a script

2013-01-06 Thread marc.assin
Hello, I've just installed Python 2.7 on Windows 7 I've been able to write and run a script Hello world I wonder how I could specify a parameter on the command line from within the interpreter. Specifying a parameter on the DOS command line is no problem. Any hint, please ? --

Re: Newbee question about running a script

2013-01-06 Thread Miki Tebeka
On Sunday, January 6, 2013 8:03:43 AM UTC-8, marc.assin wrote: I wonder how I could specify a parameter on the command line from within the interpreter. Guido wrote some advice a while back - http://www.artima.com/weblogs/viewpost.jsp?thread=4829 Import your module and call its main. The

Re: Newbee Question

2007-08-21 Thread Asun Friere
Oh well since a few solutions have already been posted I thought I might add another, just so you at the very least you have to do some work making up your mind which one to choose. Using an incremental approach just to be different ... from decimal import Decimal normal = Decimal('0.04') over

Re: Newbee Question

2007-08-21 Thread Asun Friere
On Aug 21, 5:41 pm, Asun Friere [EMAIL PROTECTED] wrote: over = Decimal('1.40) oops, that should of course be: over = Decimal('1.40') -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbee Question

2007-08-21 Thread Asun Friere
On Aug 21, 5:51 pm, Asun Friere [EMAIL PROTECTED] wrote: On Aug 21, 5:41 pm, Asun Friere [EMAIL PROTECTED] wrote: over = Decimal('1.40) oops, that should of course be: over = Decimal('1.40') oh boy ... and it should also be normal = Decimal('0.40') I really need to test before posting ...

Re: Newbee Question

2007-08-21 Thread Ant
On Aug 20, 11:47 pm, [EMAIL PROTECTED] wrote: ... Thanks for the help. By the way I am trying to learn the python after work and on weekends. If it was a dumb question, to this group, I will not bother you all again. It's not so much that it was a dumb question, but that it was asked in a dumb

Re: Newbee Question

2007-08-21 Thread Steve Holden
[EMAIL PROTECTED] wrote: [...] Thanks for the help. By the way I am trying to learn the python after work and on weekends. If it was a dumb question, to this group, I will not bother you all again. Without help it will take me longer to learn. Thanks Don't worry about it. There is also a

Re: Newbee Question

2007-08-21 Thread [EMAIL PROTECTED]
On Aug 21, 4:38 am, Ant [EMAIL PROTECTED] wrote: On Aug 20, 11:47 pm, [EMAIL PROTECTED] wrote: ... Thanks for the help. By the way I am trying to learn the python after work and on weekends. If it was a dumb question, to this group, I will not bother you all again. It's not so much that

Re: Newbee Question

2007-08-21 Thread sentientholon
On Aug 21, 11:52 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I tryed your code and got an error message #I use Wing IDE: Python 2.2.3 (#42, May 30 2003, 18:12:08) [MSC 32 bit (Intel)] Type help, copyright, credits or license for more information. Evaluating lines 1-16 from truckStops.py

Re: Newbee Question

2007-08-21 Thread Dave Hansen
On Aug 21, 2:57 am, Dennis Lee Bieber [EMAIL PROTECTED] wrote: [...] pay = min(num, 22) * 0.4 + max(num-22, 0) * 1.4 pay = num*0.4 + (num22)*(num-22) ;-) -=Dave -- http://mail.python.org/mailman/listinfo/python-list

Newbee Question

2007-08-20 Thread HD1956
This is probably a simple code. I am a truck driver who gets paid by stops and cases. I am trying to figure out how to code my stop pay. I get 40 cents per stop up to 22 stops, and $1.40 per stops after that. -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbee Question

2007-08-20 Thread kyosohma
On Aug 20, 9:23 am, HD1956 [EMAIL PROTECTED] wrote: This is probably a simple code. I am a truck driver who gets paid by stops and cases. I am trying to figure out how to code my stop pay. I get 40 cents per stop up to 22 stops, and $1.40 per stops after that. def calc(num): if num

Re: Newbee Question

2007-08-20 Thread Shawn Milochik
#!/usr/bin/env python normalPay = 0.4 overPay = 1.4 normalLimit = 22 def calcPay(numStops): pay = 0 if numStops normalLimit: pay = overPay * (numStops - normalLimit) numStops = normalLimit return pay + (numStops * normalPay) if __name__ == __main__: print

Re: Newbee Question

2007-08-20 Thread Shawn Milochik
On 8/20/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: On Aug 20, 9:23 am, HD1956 [EMAIL PROTECTED] wrote: This is probably a simple code. I am a truck driver who gets paid by stops and cases. I am trying to figure out how to code my stop pay. I get 40 cents per stop up to 22 stops, and

Re: Newbee Question

2007-08-20 Thread Diez B. Roggisch
HD1956 schrieb: This is probably a simple code. I am a truck driver who gets paid by stops and cases. I am trying to figure out how to code my stop pay. I get 40 cents per stop up to 22 stops, and $1.40 per stops after that. Sounds a bit like homework. Which usually isn't simply delivered

Re: Newbee Question

2007-08-20 Thread kyosohma
On Aug 20, 9:58 am, Shawn Milochik [EMAIL PROTECTED] wrote: On 8/20/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: On Aug 20, 9:23 am, HD1956 [EMAIL PROTECTED] wrote: This is probably a simple code. I am a truck driver who gets paid by stops and cases. I am trying to figure out how to

Re: Newbee Question

2007-08-20 Thread Shawn Milochik
I like to write code, so it's not a big deal when it's something so simple. Still, that is beyond dumb! Nice code, by the way. Mike Yeah, it was fun to write anyway. Thanks for the compliment on the code. I still consider myself a Python newbie, so it's good to know I'm not trying to write it

Re: Newbee Question

2007-08-20 Thread Wildemar Wildenburger
Diez B. Roggisch wrote: Sounds a bit like homework. Which usually isn't simply delivered here. Wrong! Usually that happens pretty quickly here (as proven again in this case). Not that it should, but only the seniors seem to detect lazy learners. /W --

Re: Newbee Question

2007-08-20 Thread Paul McGuire
On Aug 20, 9:23 am, HD1956 [EMAIL PROTECTED] wrote: This is probably a simple code. I am a truck driver who gets paid by stops and cases. I am trying to figure out how to code my stop pay. I get 40 cents per stop up to 22 stops, and $1.40 per stops after that. You'll get top marks for turning

Re: Newbee Question

2007-08-20 Thread Neil Cerutti
On 2007-08-20, HD1956 [EMAIL PROTECTED] wrote: This is probably a simple code. I am a truck driver who gets paid by stops and cases. I am trying to figure out how to code my stop pay. I get 40 cents per stop up to 22 stops, and $1.40 per stops after that. I wish *I* could make a deal like

Re: Newbee Question

2007-08-20 Thread hd1956
On Aug 20, 11:06 am, [EMAIL PROTECTED] wrote: On Aug 20, 9:58 am, Shawn Milochik [EMAIL PROTECTED] wrote: On 8/20/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: On Aug 20, 9:23 am, HD1956 [EMAIL PROTECTED] wrote: This is probably a simple code. I am a truck driver who gets paid by

Re: Newbee Question

2007-08-20 Thread James Stroud
[EMAIL PROTECTED] wrote: On Aug 20, 11:06 am, [EMAIL PROTECTED] wrote: On Aug 20, 9:58 am, Shawn Milochik [EMAIL PROTECTED] wrote: On 8/20/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: On Aug 20, 9:23 am, HD1956 [EMAIL PROTECTED] wrote: This is probably a simple code. I am a truck

sudo open() ? (python newbee question)

2005-06-14 Thread slava
hello, i am writing a python script that will be run by a non root user the script needs to open a file in write mode that is owned by root file = open('/etc/apt/sources.list', 'r+') returns permission error how can i call sudo on open()? thanks alot slava --

Re: sudo open() ? (python newbee question)

2005-06-14 Thread Denis WERNERT
The script could be SUID Root, and you could use os.setuid immediately after having performed the task to switch to a non-priviledged user. May be a big security risk, if someone can alter the script, he gains root access to the system... [EMAIL PROTECTED] wrote: hello, i am writing a python

Re: sudo open() ? (python newbee question)

2005-06-14 Thread Dan Sommers
On Tue, 14 Jun 2005 11:52:13 +0200, Denis WERNERT [EMAIL PROTECTED] wrote: The script could be SUID Root, and you could use os.setuid immediately after having performed the task to switch to a non-priviledged user. May be a big security risk, if someone can alter the script, he gains root

Re: sudo open() ? (python newbee question)

2005-06-14 Thread TZOTZIOY
On 14 Jun 2005 08:12:17 -0400, rumours say that Dan Sommers [EMAIL PROTECTED] might have written: On Tue, 14 Jun 2005 11:52:13 +0200, Denis WERNERT [EMAIL PROTECTED] wrote: The script could be SUID Root, and you could use os.setuid immediately after having performed the task to switch to a

Re: sudo open() ? (python newbee question)

2005-06-14 Thread Dan Sommers
On Tue, 14 Jun 2005 16:18:19 +0300, Christos TZOTZIOY Georgiou [EMAIL PROTECTED] wrote: I believe that the suid bit on scripts (either *sh or python) is completely ignored on most *nix systems. Most *modern* systems, yes. ;-) I must be getting old. :-( Regards, Dan -- Dan Sommers

Newbee question : List of packages

2005-06-01 Thread Sébastien V.
Hello, I'm quite new in Python and I discover every day very interesting new packages in this newsgroup : Is there somewhere on the web a list (as complete as possible) in which main features of external packages are listed ? Sebastien -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbee question : List of packages

2005-06-01 Thread Simon Brunning
On 6/1/05, Sébastien V. [EMAIL PROTECTED] wrote: I'm quite new in Python and I discover every day very interesting new packages in this newsgroup : Is there somewhere on the web a list (as complete as possible) in which main features of external packages are listed Try