Hi Thierry,

If I understand you correctly, you are trying to execute your script
essai.py. In your second example, however, you are importing your script as
a module. It does not mean your script is part of spyder.

In spyder there is a very easy way to execute your script: press F5 (or via
the menu: run > run (F5)). You can chose in which kind of console (Ipython
or standard python) and you can also check the box "interact with python
interpreter after execution" if you would like to interact with your results
via the Ipython or python console and for instance check the variables in
the variable explorer.

I can also recommend you to check the documentation of spyder:
http://packages.python.org/spyder/index.html

Some more handy links for learning python which I really recommend to go
through: it will safe you a lot of misery.

How to Think Like a Computer Scientist: Learning with Python 2nd Edition
http://openbookproject.net/thinkCSpy/

Python Scientific Lecture Notes
http://scipy-lectures.github.com/

Hope this helps,

Regards,
David


On 5 July 2011 10:08, Thierry NOVO <[email protected]> wrote:

> Hello,
> I 'm very interesting in Spyder IDE because I decided to learn Python
> and Object Oriented Programming.
> I wrote in a file essai.py, this simple instructions:
> x=2
> y=3
> z = x+y
> print(z)
>
> In the console(IPython 1), I have the following results:
>
> In [3]: essai
> ------------------------------------------------------------
> Traceback (most recent call last):
>  File "<ipython console>", line 1, in <module>
> NameError: name 'essai' is not defined
>
> In [4]: import essai
> 11
>
> In [5]: essai
> Out[5]: <module 'essai' from 'essai.pyc'>
>
> and the variables x,y and z don't appear in Variable Explorer.
>
> My script essai.py seems to be a module for Spyder !!!
> Thanks for your answer.
> Thierry
>
> --
> You received this message because you are subscribed to the Google Groups
> "spyder" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/spyderlib?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"spyder" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/spyderlib?hl=en.

Reply via email to