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 -
>>> import urllib2, sched, time, re
-
>>> def debtcheck():
-
... webpage = urllib2.urlopen('http://www.brillig.com/debt_clock/')
-
... results = webpage.read()
-
... total_debt = re.compile('<TR><TD ALIGN=center><IMG SRC="debtiv.gif" WIDTH=399 HEIGHT=41 ALT=(.*?)</TD>',re.M|re.DOTALL)
-
... debt_data = total_debt.findall(results)
-
... return debt_data
-
...
-
>>> s=sched.scheduler(time.time, time.sleep)
-
>>> def print_debt():
-
... s.enter(5, 1, debtcheck, ())
-
... s.enter(35, 1, debtcheck, ())
-
... s.enter(65, 1, debtcheck, ())
-
... s.run()
-
...
-
>>> print print_debt()
-
None
-
-
1 1129
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 -
>>> import urllib2, sched, time, re
-
>>> def debtcheck():
-
... webpage = urllib2.urlopen('http://www.brillig.com/debt_clock/')
-
... results = webpage.read()
-
... total_debt = re.compile('<TR><TD ALIGN=center><IMG SRC="debtiv.gif" WIDTH=399 HEIGHT=41 ALT=(.*?)</TD>',re.M|re.DOTALL)
-
... debt_data = total_debt.findall(results)
-
... return debt_data
-
...
-
>>> s=sched.scheduler(time.time, time.sleep)
-
>>> def print_debt():
-
... s.enter(5, 1, debtcheck, ())
-
... s.enter(35, 1, debtcheck, ())
-
... s.enter(65, 1, debtcheck, ())
-
... s.run()
-
...
-
>>> print print_debt()
-
None
-
-
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.
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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...
|
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...
|
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,...
|
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....
|
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)
|
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\"...
|
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,...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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)...
|
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....
|
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...
|
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...
| |