473,666 Members | 2,111 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 989
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 cell shows up outside, making it nearly illegible. (Also, the page background color does not render -- it's just a white background.) The page is here: www.afwh.org. This is the CSS: www.afwh.org/css.htm
0
854
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 compiled. Well, this add in, when used with a project, did something that messed up the .NET help collection. Immediately afterwards, there was no index available, and search was gone.
3
1416
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 .csv file. So there are blank spaces being added here and there causing them to read as 'add comma' when saving to .csv format. Even the column data is messed up... example: ,photo_mod_time,photo_mo,d_date, should read...
6
2313
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 max_size is larger than 28. why is that? I found this out by playing with max_size after I couldn't figure out what I did wrong. thx a bunch
3
5824
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. Access sets indexes on certain fields with "Code" in the field. Even if I remove these index, the order is close, but still some of the fields are out of order.
3
1516
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 trying to add new record): "The changes you requested to the table were not successful because they would create duplicate values in the index primary key or relationship. Change the data in the field or fields that contation duplicate data, remove...
1
1713
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 control. The user selects one of the items in the list. The Details page retrieves details for the selected item, and displays the results using Label controls. My problem is that some of the entries in the database have French characters in them. They...
3
1967
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 address, and did a full restore. Not only were some permissions messed up, but Crystal Reports 10 and some Access Data Projects refused to run. I finally discovered while running an SP_WHO that the individual database names that we'd created (meaning...
11
1662
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 what was in there (and i didn't make a back up ) The program i used changed the formatting and i didn't realize this. Is this an acceptable practice to edit this file as long as you don't change the formatting? now i get this error on the...
2
1779
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 in design view, and also tried to run the query afterwards, they both gave me the same result: Access would close with no error message at all. I can't think of anything other than the Compact & Repair Database that could've done this. Now this isn't...
0
8448
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
8552
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8640
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6198
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4198
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4369
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2773
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.