A question about IDLE and environment variables

2007-01-09 Thread Tristan
Hello community:
I post this because I could not find satisfactory answers in the posts
generated by this nice group.
I work on winXP. I have many little python applications in different
folders, each application can share or not other objects located in the
same or other folders.
The way I work to use these applications is:
1)  For almost everyone, I execute a corresponding ".bat file" into
which I define and/or include values for some "temporal"
environment variables that let me find all the objects that the
selected application uses. Sometimes I include in the .bat file the
execution of the application, but generally I leave in a prompt status,
ready to invoke python or some dos commands.
2)  When I close the command prompt window, there are no traces of my
enviroment variables in my windows system (that is right). Only the
default windows environment variables remain.

I tried to do the same with the IDLE (and I imagine tha same occurs
with Python command line), but I have the next problem:
I can not find in IDLE (or another app?) the way to previously define
and/or include automatically values for my "temporal" environment
variables as I do in the .bat files. The use of Control Panel -> System
-> Advanced is tedious to use as, my enviroment variables values are
"temporal". 
Any advice,  please???

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: About IDLE?

2006-03-09 Thread Terry Reedy

"Dr. Pastor" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Installed Python 2.4.2 on Windows XP.
> Activated IDLE.
> Loaded the following into the Edit window:

> Why I do not get any output?
> Thanks for any guidance.

When you run code from an edit window, IDLE saves the file to disk and then 
*imports* it into the shell window.  If you *paste* code into the shell 
window (regardless of where from), then it acts like you typed it and you 
will get expression results echoed, as you expected.

I got caught be this at first too, since I have run many snippets by 
pasting.

Terry Jan Reedy



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: About IDLE?

2006-03-09 Thread Dr. Pastor
Thank you! I can see only your reply.
But indeed google prints three.
The mind boggles.


Nick Smallbone wrote:

> Dr. Pastor wrote:
> 
>>Any reply?
>>
> 
> 
> ahem. three replies, when i counted:
> http://groups.google.com/group/comp.lang.python/browse_frm/thread/ab0c8455251e616c/
> 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: About IDLE?

2006-03-09 Thread Nick Smallbone
Dr. Pastor wrote:
> Any reply?
>

ahem. three replies, when i counted:
http://groups.google.com/group/comp.lang.python/browse_frm/thread/ab0c8455251e616c/

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: About IDLE?

2006-03-09 Thread Dr. Pastor
Any reply?

Dr. Pastor wrote:
> Installed Python 2.4.2 on Windows XP.
> Activated IDLE.
> Loaded the following into the Edit window:
> ---
> # dates are easily constructed and formatted (Tutorial 10.8)
> 
> from datetime import date
> now = date.today()
> now
> 
> now.strftime("%m-%d-%y. %d %b %Y is a %A on the %d day of %B.")
> 
> # dates support calendar arithmetic
> 
> birthday = date(1985, 12, 1)
> age = now - birthday
> age.days
> ---
> When I select Run Module in the Edit window, I got only
> two >>> after the RESTART line.
> I expected to see the output of several commands!
> Typing in age.days do produce the number of days.
> 
> Why I do not get any output?
> Thanks for any guidance.
> 
> 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: About IDLE?

2006-03-09 Thread Nick Smallbone
Sybren Stuvel wrote:
> Dr. Pastor enlightened us with:
> > When I select Run Module in the Edit window, I got only
> > two >>> after the RESTART line.
> > I expected to see the output of several commands!
>
> You never gave it any commands that print output.
>
> I suggest reading the Python tutorial.
>

To be more specific, when you type in an expression at the Python
prompt, it will evaluate it and then print it (if it doesn't evaluate
to None). In a module it doesn't do that, as then you'd have all sorts
of things printed out modules were imported.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: About IDLE?

2006-03-09 Thread Sybren Stuvel
Dr. Pastor enlightened us with:
> When I select Run Module in the Edit window, I got only
> two >>> after the RESTART line.
> I expected to see the output of several commands!

You never gave it any commands that print output.

I suggest reading the Python tutorial.

Sybren
-- 
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't we just take the
safety labels off of everything and let the problem solve itself? 
 Frank Zappa
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: About IDLE?

2006-03-09 Thread Fredrik Lundh
"Dr. Pastor" wrote:

> Installed Python 2.4.2 on Windows XP.
> Activated IDLE.
> Loaded the following into the Edit window:
> ---
> # dates are easily constructed and formatted (Tutorial 10.8)
>
> from datetime import date
> now = date.today()
> now
>
> now.strftime("%m-%d-%y. %d %b %Y is a %A on the %d day of %B.")
>
> # dates support calendar arithmetic
>
> birthday = date(1985, 12, 1)
> age = now - birthday
> age.days
> ---
> When I select Run Module in the Edit window, I got only
> two >>> after the RESTART line.
> I expected to see the output of several commands!
> Typing in age.days do produce the number of days.
>
> Why I do not get any output?

while the interactive console echoes the result back if you type in an
arbitrary expression, the interpreter doesn't do that if you run things in
a script.

to print stuff from a script, use the "print" statement.

print now
print now.strftime(...)
...
print age.days

your favourite tutorial (hopefully) contains more information about the
interactive mode, and how it differs from code in scripts or modules.

hope this helps!





-- 
http://mail.python.org/mailman/listinfo/python-list


About IDLE?

2006-03-09 Thread Dr. Pastor
Installed Python 2.4.2 on Windows XP.
Activated IDLE.
Loaded the following into the Edit window:
---
# dates are easily constructed and formatted (Tutorial 10.8)

from datetime import date
now = date.today()
now

now.strftime("%m-%d-%y. %d %b %Y is a %A on the %d day of %B.")

# dates support calendar arithmetic

birthday = date(1985, 12, 1)
age = now - birthday
age.days
---
When I select Run Module in the Edit window, I got only
two >>> after the RESTART line.
I expected to see the output of several commands!
Typing in age.days do produce the number of days.

Why I do not get any output?
Thanks for any guidance.


-- 
http://mail.python.org/mailman/listinfo/python-list