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

two silly questions

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.

Jul 18 '05 #1
3 1219
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 <mi*********@zoran.com>
The only difference between children and adults is the price of the toys.

Jul 18 '05 #2
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" <bi*********@clear.net.nz> wrote in message
news:up********************************@4ax.com...
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.

Jul 18 '05 #3
On Thu, 3 Jun 2004 10:49:50 -0500, "Larry Bates"
<lb****@swamisoft.com> 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" <bi*********@clear.net.nz> wrote in message
news:up********************************@4ax.com.. .
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.


Jul 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Salve Håkedal | last post by:
Maybee my believe in php is a little too big.. When submitting a small string multiple times with this form, I'd expect $file to build up. Why does $file contain only the last submit? <html>...
4
by: Jenny | last post by:
Hi you al I have two very silly question The first one is In vb 6.0 you can add a procedure, sub or function, by clicking add procedure from the tools item on the menuba I cannot seem to find...
3
by: Nemisis | last post by:
Hi everyone, i have currently got a classic asp web application and am wanting to upgrade it to asp.net 2.0, and also take advantage of OOP. Our current application is not using OOP so you can...
8
by: Geoff Cox | last post by:
Hello, I cannot see what is wrong with this. Even though the loop gives a value for each of the 36 values of the lab_result array I get the "Please answer all the questions" alert. Why?! ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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...

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.