[IPython-user] passing negative float as arguments to a script
Johann Cohen-Tanugi
cohen@slac.stanford....
Sun Jul 27 19:39:32 CDT 2008
hi there,
I apologize for this horrendously trivial question but :
[cohen@jarrett ~]$ more testneg.py
import sys
if __name__=='__main__':
print sys.argv[1]
num=float(sys.argv[1])
print "First arg is : %g"%num
gives me :
[cohen@jarrett ~]$ python testneg.py -1
-1
First arg is : -1
[cohen@jarrett ~]$ ipython
Python 2.5.1 (r251:54863, Jun 15 2008, 23:59:20)
Type "copyright", "credits" or "license" for more information.
IPython 0.9.0.bzr.r1016 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.
In [1]: run testneg -1
-1
First arg is : -1
In [2]:
Do you really want to exit ([y]/n)?
[cohen@jarrett ~]$ ipython testneg.py -1
<long ipython help message>
WARNING:
Error in Arguments: "Illegal option '-1'"
So what should I do? I tried some sequences of quotes/double
quotes/escape char without success.
thanks in advance :(
Johann
More information about the IPython-user
mailing list