Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > two silly questions

Reply
Thread Tools

two silly questions

 
 
bill ramsay
Guest
Posts: n/a
 
      06-03-2004
Hello

just found the wonderful world of python in the last two weeks and I
think that it is great.

I have a couple of questions for those who are wiser a la python than
I am.

Background:

I have written a program that polls an email account, then pulls down
the email, it then searches through the email, and depending upon
type, ie. with or without attachments it does different things. The
net result is that data is written to access tables for an external
application to extract the necessary data.

I am using win2k.

the two questions are:

1. when i want the program to run in a loop, ie. poll the pop3
account every 60 seconds, it runs the first time, then it goes into
'not responding mode' thereafter, sometimes. Any thoughts? I was
using sleep(60) but it just hangs, as i said before, it does not
always do that either!

2. I wish to use this program at work, I took in an earlier version
yesterday that just wrote the data to a text file, I wanted to make
sure the polling thing worked. on microsoft exchange [i know that it
should, but you never know!!] and it does . When i was there, i
managed to get the code to run just by double clicking on the code
ICON, seem to remember doing something with 'open with' can't seem to
do it here at home.

Both systems run win2k. did i do something sublimilally without
realising it? what did i do i cannot remember, i have tried opening
with etc. when i do this all get is a burst of the 'black windows
box' just in the same way as putting in 'cmd' on the run thing,

as you can see i am not up on all the terms.

if anyone can help, i would appreciate it.

kind regards

bill ramsay.

 
Reply With Quote
 
 
 
 
Miki Tebeka
Guest
Posts: n/a
 
      06-03-2004
Hello Bill,

> 1. when i want the program to run in a loop, ie. poll the pop3
> account every 60 seconds, it runs the first time, then it goes into
> 'not responding mode' thereafter, sometimes. Any thoughts? I was
> using sleep(60) but it just hangs, as i said before, it does not
> always do that either!

Do you mean it sometime hang? IMO it point to a bug in your code.
Try adding a lot of "print 'I am here'" in your code and reduce the
sleep time to 0.1 and run. See where you get stuck.

> 2. I wish to use this program at work, I took in an earlier version
> yesterday that just wrote the data to a text file, I wanted to make
> sure the polling thing worked. on microsoft exchange [i know that it
> should, but you never know!!] and it does . When i was there, i
> managed to get the code to run just by double clicking on the code
> ICON, seem to remember doing something with 'open with' can't seem to
> do it here at home.

The standard Python installer associates .py with python so when you
click on a .py file (or call it from the command line) it runs the
Python interpreter on it.

If you don't want to see the "black window" rename the extension to
..pyw, this way pythonw.exe will run the script and won't produce any
console. OTOH it means you won't see any printing what so ever so make
sure you log *everything*.

HTH.
Bye.
--
-------------------------------------------------------------------------
Miki Tebeka <>
The only difference between children and adults is the price of the toys.

 
Reply With Quote
 
 
 
 
Larry Bates
Guest
Posts: n/a
 
      06-03-2004
The absolute "best" way to do what you want is to write
an NT service. Mark Hammond's Python Programming on
Win32 has excellent examples of this. NT services
run in the background and can be set to actually sleep
for any amount of time (in microseconds). I've written
several of these and while the learning curve is a
little steep on the front end, the resulting application
is MUCH better.

HTH,
Larry Bates
Syscon, Inc.

"bill ramsay" <> wrote in message
news:...
> Hello
>
> just found the wonderful world of python in the last two weeks and I
> think that it is great.
>
> I have a couple of questions for those who are wiser a la python than
> I am.
>
> Background:
>
> I have written a program that polls an email account, then pulls down
> the email, it then searches through the email, and depending upon
> type, ie. with or without attachments it does different things. The
> net result is that data is written to access tables for an external
> application to extract the necessary data.
>
> I am using win2k.
>
> the two questions are:
>
> 1. when i want the program to run in a loop, ie. poll the pop3
> account every 60 seconds, it runs the first time, then it goes into
> 'not responding mode' thereafter, sometimes. Any thoughts? I was
> using sleep(60) but it just hangs, as i said before, it does not
> always do that either!
>
> 2. I wish to use this program at work, I took in an earlier version
> yesterday that just wrote the data to a text file, I wanted to make
> sure the polling thing worked. on microsoft exchange [i know that it
> should, but you never know!!] and it does . When i was there, i
> managed to get the code to run just by double clicking on the code
> ICON, seem to remember doing something with 'open with' can't seem to
> do it here at home.
>
> Both systems run win2k. did i do something sublimilally without
> realising it? what did i do i cannot remember, i have tried opening
> with etc. when i do this all get is a burst of the 'black windows
> box' just in the same way as putting in 'cmd' on the run thing,
>
> as you can see i am not up on all the terms.
>
> if anyone can help, i would appreciate it.
>
> kind regards
>
> bill ramsay.
>



 
Reply With Quote
 
bill ramsay
Guest
Posts: n/a
 
      06-04-2004
On Thu, 3 Jun 2004 10:49:50 -0500, "Larry Bates"
<> wrote:

>The absolute "best" way to do what you want is to write
>an NT service. Mark Hammond's Python Programming on
>Win32 has excellent examples of this. NT services
>run in the background and can be set to actually sleep
>for any amount of time (in microseconds). I've written
>several of these and while the learning curve is a
>little steep on the front end, the resulting application
>is MUCH better.
>


thanks for this, much appreciated, funnily enough i had a sniff in
there today, and i think i found what you are reffering to.

kind regards

bill ramsay



>HTH,
>Larry Bates
>Syscon, Inc.
>
>"bill ramsay" <> wrote in message
>news:.. .
>> Hello
>>
>> just found the wonderful world of python in the last two weeks and I
>> think that it is great.
>>
>> I have a couple of questions for those who are wiser a la python than
>> I am.
>>
>> Background:
>>
>> I have written a program that polls an email account, then pulls down
>> the email, it then searches through the email, and depending upon
>> type, ie. with or without attachments it does different things. The
>> net result is that data is written to access tables for an external
>> application to extract the necessary data.
>>
>> I am using win2k.
>>
>> the two questions are:
>>
>> 1. when i want the program to run in a loop, ie. poll the pop3
>> account every 60 seconds, it runs the first time, then it goes into
>> 'not responding mode' thereafter, sometimes. Any thoughts? I was
>> using sleep(60) but it just hangs, as i said before, it does not
>> always do that either!
>>
>> 2. I wish to use this program at work, I took in an earlier version
>> yesterday that just wrote the data to a text file, I wanted to make
>> sure the polling thing worked. on microsoft exchange [i know that it
>> should, but you never know!!] and it does . When i was there, i
>> managed to get the code to run just by double clicking on the code
>> ICON, seem to remember doing something with 'open with' can't seem to
>> do it here at home.
>>
>> Both systems run win2k. did i do something sublimilally without
>> realising it? what did i do i cannot remember, i have tried opening
>> with etc. when i do this all get is a burst of the 'black windows
>> box' just in the same way as putting in 'cmd' on the run thing,
>>
>> as you can see i am not up on all the terms.
>>
>> if anyone can help, i would appreciate it.
>>
>> kind regards
>>
>> bill ramsay.
>>

>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
My two questions. One legit, one silly... phaeton C Programming 5 12-29-2011 04:52 AM
XML Schema questions (hopefully not too silly) Gus Gassmann XML 3 09-20-2007 12:03 PM
Silly Newbie questions Cerveza Mas Fina Perl Misc 2 01-17-2007 06:18 AM
Silly questions about True and False drs Python 3 12-20-2004 07:04 PM
And yet again more silly questions... GGarramuno Ruby 1 12-30-2003 05:26 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57