two silly questions

Discussion in 'Python' started by bill ramsay, Jun 3, 2004.

  1. bill ramsay

    bill ramsay Guest

    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.
     
    bill ramsay, Jun 3, 2004
    #1
    1. Advertising

  2. bill ramsay

    Miki Tebeka Guest

    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.
     
    Miki Tebeka, Jun 3, 2004
    #2
    1. Advertising

  3. bill ramsay

    Larry Bates Guest

    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.
    >
     
    Larry Bates, Jun 3, 2004
    #3
  4. bill ramsay

    bill ramsay Guest

    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.
    >>

    >
     
    bill ramsay, Jun 4, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. drs
    Replies:
    3
    Views:
    416
    Steven Bethard
    Dec 20, 2004
  2. Gus Gassmann
    Replies:
    3
    Views:
    458
    Martin Honnen
    Sep 20, 2007
  3. phaeton

    My two questions. One legit, one silly...

    phaeton, Dec 27, 2011, in forum: C Programming
    Replies:
    5
    Views:
    316
    /dev/phaeton
    Dec 29, 2011
  4. GGarramuno
    Replies:
    1
    Views:
    131
    Eric Hodel
    Dec 30, 2003
  5. Cerveza Mas Fina

    Silly Newbie questions

    Cerveza Mas Fina, Jan 17, 2007, in forum: Perl Misc
    Replies:
    2
    Views:
    136
    Mumia W. (NOSPAM)
    Jan 17, 2007
Loading...

Share This Page