473,398 Members | 2,368 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

About IDLE?

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.
Mar 9 '06 #1
7 1065
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
Mar 9 '06 #2
"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!

</F>

Mar 9 '06 #3
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.

Mar 9 '06 #4
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.

Mar 10 '06 #5
Dr. Pastor wrote:
Any reply?


ahem. three replies, when i counted:
http://groups.google.com/group/comp....c8455251e616c/

Mar 10 '06 #6
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....c8455251e616c/

Mar 10 '06 #7

"Dr. Pastor" <el**@adsihqX.com> wrote in message
news:zs****************@newsread3.news.pas.earthli nk.net...
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

Mar 10 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: Kerry Neilson | last post by:
For the past couple of months, Idle won't start when I invoke it. I am at a complete loss for why this is. When this happens, they python command line still starts, and python works fine...
1
by: Moosebumps | last post by:
So say I am working on two separate .py files in IDLE that are part of the same program. Does anyone have problems where when you modify one file, and then run the other, the changes you made in...
1
by: dbrown2 | last post by:
I typically use IDLE for editing and debug. On Windows at least, IDLE and the standard turtle graphics module do not mix. I think both use Tkinter. For now I use IPython and Jedit when using...
1
by: Player | last post by:
Hell all once again :) I just installed Python after giving Activestates distribution of python a try for a few days, and I have come across something that strikes me as a little weird, to my...
8
by: Jonathan Polley | last post by:
I have one account on a WindowsXP machine that refuses to run IDLE (or any other python script that uses Tk). Other people can login to that PC and IDLE runs just fine, so it is not an...
19
by: Frank Rizzo | last post by:
I want to log the user out when there has been a period of inactivity in the application. The key here is inactivity of the application, not the system. I know that you can retrieve the...
7
by: iwdu15 | last post by:
how can i tell if my system has gone idle? then how can i execute a command accordingly? thnks
0
by: Stefan Felkel | last post by:
hi! i have searched a lot in these pgsql-groups and on the internet, but found no really helpful information for my problem. the famous error >> database "xyz" is being accessed by other...
14
by: Omar | last post by:
1) why don't python / idle use numbered lines in their scripting, like basic? how do you keep track of large batches of code without them? 2) in IDLE, how do you save a program such that it can...
0
by: Terry Reedy | last post by:
Murphy.MarkS@epamail.epa.gov wrote: I have both 2.5.2 and 3.0b2 loaded for all users on stock xp with all upgrades. I put /Python25 and /Python30 under Program Files instead of C:. As normal...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.