473,508 Members | 2,006 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

messed up RE....i think

54 New Member
So I'm trying to just write a script that checks to see the national debt every minute for 3 minutes. (the time and duration is completely variable, im making up these tests for me to learn on)...

So the script I have, which I've written by cutting and pasting from previous questions i've had answered and from what i've found on python.org, yields "None," rather than 3 gigantic debt figures.

Can someone help me (i'm using Windows XP on python 2.5) find where I've gone arwy...
thanks a lot...

PC

Expand|Select|Wrap|Line Numbers
  1. >>> def debtcheck():
  2. ...     webpage = urllib2.urlopen('http://www.brillig.com/debt_clock/')
  3. ...     results2 = webpage.read()
  4. ...     total_debt = re.compile('<TR><TD ALIGN=center><IMG SRC="debtiv.gif" WIDTH=399 HEIGHT=41 ALT=(.*?)</TD>',re.M|re.DOTALL)
  5. ...     debt_data = total_debt.findall(results)
  6. ...     
  7. >>> import sched, time
  8. >>> s=sched.scheduler(time.time, time.sleep)
  9. >>> def print_debt():
  10. ...     s.enter(5, 1, debtcheck, ())
  11. ...     s.enter(65, 1, debtcheck, ())
  12. ...     s.enter(125, 1, debtcheck, ())
  13. ...     s.run()
  14. ...     
  15.  
  16. >>> def print_debt():
  17. ...     s.enter(5, 1, debtcheck, ())
  18. ...     s.enter(65, 1, debtcheck, ())
  19. ...     s.enter(125, 1, debtcheck, ())
  20. ...     s.run()
  21. ... 
  22. >>> print print_debt()
  23. None
Apr 20 '07 #1
1 984
ghostdog74
511 Recognized Expert Contributor
So I'm trying to just write a script that checks to see the national debt every minute for 3 minutes. (the time and duration is completely variable, im making up these tests for me to learn on)...

So the script I have, which I've written by cutting and pasting from previous questions i've had answered and from what i've found on python.org, yields "None," rather than 3 gigantic debt figures.

Can someone help me (i'm using Windows XP on python 2.5) find where I've gone arwy...
thanks a lot...

PC

Expand|Select|Wrap|Line Numbers
  1. >>> def debtcheck():
  2. ...     webpage = urllib2.urlopen('http://www.brillig.com/debt_clock/')
  3. ...     results2 = webpage.read()
  4. ...     total_debt = re.compile('<TR><TD ALIGN=center><IMG SRC="debtiv.gif" WIDTH=399 HEIGHT=41 ALT=(.*?)</TD>',re.M|re.DOTALL)
  5. ...     debt_data = total_debt.findall(results)
  6. ...     
  7. >>> import sched, time
  8. >>> s=sched.scheduler(time.time, time.sleep)
  9. >>> def print_debt():
  10. ...     s.enter(5, 1, debtcheck, ())
  11. ...     s.enter(65, 1, debtcheck, ())
  12. ...     s.enter(125, 1, debtcheck, ())
  13. ...     s.run()
  14. ...     
  15.  
  16. >>> def print_debt():
  17. ...     s.enter(5, 1, debtcheck, ())
  18. ...     s.enter(65, 1, debtcheck, ())
  19. ...     s.enter(125, 1, debtcheck, ())
  20. ...     s.run()
  21. ... 
  22. >>> print print_debt()
  23. None
first look, you did not return any values in your debtcheck() function that's why you have None.. return debt_data in that function, and i think it should be fine.
Apr 21 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
539
by: | last post by:
I have a page here that validates as XHTML 1.0 strict that works fine in Safari, Mozilla, and IE for the PC, but in IE 5.2 for the Mac it's all messed. Text that is supposed to be inside a table...
0
849
by: Marina | last post by:
Hi, I was playing around with a tool available from gotdotnet to create documentation from xml comment in vb.net. Part of what I had to do was install an add in to allow help projects to be...
3
1408
by: ftw | last post by:
I am using SQL7 Query Analyzer. A simple select * from myMLSview and then I save results as a .csv file has the commas messed up in quite a few places. The data is messed up before I save it to the...
6
2298
by: A_StClaire_ | last post by:
hi, wrote the following program to learn a bit about auto pointers. weird thing is, the char array 'name' with size 'max_size' displays a bunch of messed up symbols after the "John Smith" if...
3
5804
by: Danny | last post by:
Hi again I am trying to import from an excel spreadsheet into access 2002, but the order that is in the spreadsheet is not preserved when I import. using DoCmd.TransferSpreadsheet in code. ...
3
1507
by: accesstribe | last post by:
Hello, I have DB located on network, and network cable was cut off accidently few days ago... now its fixed, but I can't add new records to the DB with forms... The error I get is this (when...
1
1708
by: Simon Wallis | last post by:
I have a main Listing aspx page in my app with links to a Details page. Both hit an access database. The Listing page runs a query against the db, and binds the resulting DataView to a DataGrid...
3
1959
by: David C. Barber | last post by:
Using SQL Server 2000 and moving to a new computer. We did a full backup of the existing database to tape, brought up the new computer with a clean install using the same server name and IP...
11
1652
by: quagmireman | last post by:
I am very new to perl... today is my first encounter. and i think i messed up pretty big. I was trying to update some info on a website, so i thought I could just open the index.pl file and change...
2
1771
by: RZ15 | last post by:
Hi, I was working on a query this morning and everything was working fine. Some time in the last half hour, I used the Compact & Repair Database feature. After that, when I went to open the query...
0
7226
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
7125
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7388
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...
1
7049
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...
1
5055
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3199
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3186
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
767
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
422
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.