473,322 Members | 1,345 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,322 software developers and data experts.

I'm not getting data to print out

Greetings, i'm a total amateur using py 2.5 on Win XP...

I posted a similar message last week and I made the suggestion, yet I'm ending up with the same problem...

In my script after I ask it to print i get "None" WHY is that, what can I do to fix it?

here's my script

Expand|Select|Wrap|Line Numbers
  1. >>> import urllib2, sched, time, re
  2. >>> def debtcheck():
  3. ...     webpage = urllib2.urlopen('http://www.brillig.com/debt_clock/')
  4. ...     results = webpage.read()
  5. ...     total_debt = re.compile('<TR><TD ALIGN=center><IMG SRC="debtiv.gif" WIDTH=399 HEIGHT=41 ALT=(.*?)</TD>',re.M|re.DOTALL)
  6. ...     debt_data = total_debt.findall(results)
  7. ...     return debt_data
  8. ... 
  9. >>> s=sched.scheduler(time.time, time.sleep)
  10. >>> def print_debt():
  11. ...     s.enter(5, 1, debtcheck, ())
  12. ...     s.enter(35, 1, debtcheck, ())
  13. ...     s.enter(65, 1, debtcheck, ())
  14. ...     s.run()
  15. ...     
  16. >>> print print_debt()
  17. None
  18.  
  19.  
Apr 24 '07 #1
1 1129
ilikepython
844 Expert 512MB
Greetings, i'm a total amateur using py 2.5 on Win XP...

I posted a similar message last week and I made the suggestion, yet I'm ending up with the same problem...

In my script after I ask it to print i get "None" WHY is that, what can I do to fix it?

here's my script

Expand|Select|Wrap|Line Numbers
  1. >>> import urllib2, sched, time, re
  2. >>> def debtcheck():
  3. ...     webpage = urllib2.urlopen('http://www.brillig.com/debt_clock/')
  4. ...     results = webpage.read()
  5. ...     total_debt = re.compile('<TR><TD ALIGN=center><IMG SRC="debtiv.gif" WIDTH=399 HEIGHT=41 ALT=(.*?)</TD>',re.M|re.DOTALL)
  6. ...     debt_data = total_debt.findall(results)
  7. ...     return debt_data
  8. ... 
  9. >>> s=sched.scheduler(time.time, time.sleep)
  10. >>> def print_debt():
  11. ...     s.enter(5, 1, debtcheck, ())
  12. ...     s.enter(35, 1, debtcheck, ())
  13. ...     s.enter(65, 1, debtcheck, ())
  14. ...     s.run()
  15. ...     
  16. >>> print print_debt()
  17. None
  18.  
  19.  
It is because you didn't return anything from print_debt(). Instead of return debt_data in debtcheck you can put print debt_data or store it in a file, whichever is more convenient for you. There might be a better way though because I'm not that into the sched module.
Apr 24 '07 #2

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

Similar topics

3
by: Jason | last post by:
hello, i am new to PHP, so go easy. I am using the examples in the book: PHP: Your Visual Blueprint For Creating Open Source, Server Side Content In the section where they talk about...
17
by: John Hunter | last post by:
I have a largish data set (1000 observations x 100 floating point variables), and some of the of the data are missing. I want to try a variety of clustering, neural network, etc, algorithms on the...
0
by: anuradha.k.r | last post by:
hi, i have written a simple socket program in python to connect to a windows machine.On the server side i am running a windows socket program which works perfectly fine,my server program waites at...
2
by: Fernando Rodriguez | last post by:
Hi, I need to traverse the methods defined in a class and its superclasses. This is the code I'm using: # An instance of class B should be able to check all the methods defined in B #and A,...
9
by: Ksenia Marasanova | last post by:
Hi, I have a little problem with encoding. Was hoping maybe anyone can help me to solve it. There is some amount of data in a database (PG) that must be inserted into Excel sheet and emailed....
5
by: David Bear | last post by:
Let's say I have a list called, alist. If I pass alist to a function, how can I get the name of it? alist = range(10) def afunction(list): listName = list.__name__ (fails for a list object)
11
by: Ray Muforosky | last post by:
I have this: ------------ print "<FORM name=\"form3\" ACTION=\"cmdlog_rep.php\">\n"; print "<TD><INPUT TYPE=\"submit\" VALUE=\"Submit\"></TD>\n"; .. print "<INPUT type=\"HIDDEN\"...
8
by: cypher543 | last post by:
This has been driving me insane for the last hour or so. I have search everywhere, and nothing works. I am trying to use the subprocess module to run a program and get its output line by line. But,...
5
by: olaamussah | last post by:
Hi, i just started learning perl which i would use for my uni. project unfortunately. Well, this is a simple user login page i tried to create but i cant get it to work. Can someone please check this...
0
by: Heshan Suri | last post by:
Hi, I have written a the following python code to analyse a function or a method. I am having a script which is having a python function (add) and a class (MyClass) with a method (multiply).When...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.