Hi Arian,

thanks for your reply!!

But it is still not working for me. I did the following:
1. Launch Spyder
2. In "IPython console" write
    In[1]: import interest
    In[2]: !python interest.py A=10 p=5 n=730
python: can't open file 'interest.py': [Errno 2] No such file or directory

Is it because the interest.py file is not in the recognized directory of 
Sypder? I have already added its path via "Tools" --> "PYTHONPATH manager".

Another question, why do I need to use "!python" instead of "python"?
According to the website
https://docs.python.org/3/tutorial/stdlib.html#command-line-arguments

It just says 
python demo.py one two three

Thanks again!


On Thursday, December 18, 2014 8:26:49 PM UTC+1, Adrian Klaver wrote:
>
> On 12/18/2014 08:37 AM, Lei wrote: 
> > Hi experts, 
> > 
> > I am using python 3. I got a module interest.py (see attachment). 
> > 
> > But when I tried to use this module with input in the command line, it 
> > gives error 
> > 
> > In [1]: import interest 
> > 
> > In [2]: interest.py A=10 p=5 n=730 
> >    File "<ipython-input-2-82892ebb874e>", line 1 
> >      interest.py A=10 p=5 n=730 
> >                  ^ 
> > SyntaxError: invalid syntax 
> > 
> > May you please tell me how to solve it? 
>
> Just realized you where trying to run it as a command line program. What 
> I suggested previously was for using the interest module directly in the 
> interpreter. To run as command line program in IPython do: 
>
> In [2]: !python interest.py A=10 p=5 n=730 
> ('A0 =', 9.035879331735664) 
>
> > 
> > This file "interest.py" is in the path of desktop. I think it is not a 
> > default path for Spyder. So I added its path via "Tools" --> "PYTHONPATH 
> > manager". Is it correct? 
> > 
> > By the way, I am using IPython in Spyder (version, 2.3.2), my computer 
> > is running Windows 7. 
> > 
> > Thanks a lot. 
> > 
>
>
> -- 
> Adrian Klaver 
> [email protected] <javascript:> 
>

-- 
You received this message because you are subscribed to the Google Groups 
"spyder" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/spyderlib.
For more options, visit https://groups.google.com/d/optout.

Reply via email to