Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > apscheduler error

Reply
Thread Tools

apscheduler error

 
 
linna li
Guest
Posts: n/a
 
      01-08-2011
I tried to use the apscheduler and used the sample code below from the
tutorial, but got the error message: Exception in thread APScheduler
(most likely raised during interpreter shutdown). What's going on
here? I really appreciate any help!

from apscheduler.scheduler import Scheduler

sched = Scheduler()
sched.start()

def some_job():
print "Decorated job"

sched.add_interval_job(some_job,minutes=1)
 
Reply With Quote
 
 
 
 
Steven D'Aprano
Guest
Posts: n/a
 
      01-08-2011
On Fri, 07 Jan 2011 17:08:28 -0800, linna li wrote:

> I tried to use the apscheduler and used the sample code below from the
> tutorial, but got the error message: Exception in thread APScheduler
> (most likely raised during interpreter shutdown). What's going on here?
> I really appreciate any help!



I've tried your code in every version of Python from 2.4 through 3.2, and
get an exception on the very first line every time:

ImportError: No module named apscheduler.scheduler


I think you will need to give some more detail... what version of Python
are you running, and what is apschedular?

Also, please copy and paste the exact error message, in full, including
the traceback. Don't summarise it, retype it, or paraphrase it.





--
Steven
 
Reply With Quote
 
 
 
 
Chris Rebert
Guest
Posts: n/a
 
      01-08-2011
On Fri, Jan 7, 2011 at 6:09 PM, Steven D'Aprano
<steve+> wrote:
> On Fri, 07 Jan 2011 17:08:28 -0800, linna li wrote:
>> I tried to use the apscheduler and used the sample code below from the
>> tutorial, but got the error message: Exception in thread APScheduler
>> (most likely raised during interpreter shutdown). What's going on here?
>> I really appreciate any help!

>
>
> I've tried your code in every version of Python from 2.4 through 3.2, and
> get an exception on the very first line every time:
>
> ImportError: No module named apscheduler.scheduler
>
>
> I think you will need to give some more detail... what version of Python
> are you running, and what is apschedular?


A quick Google search suggests it's http://packages.python.org/APScheduler/

Cheers,
Chris
 
Reply With Quote
 
Adam Tauno Williams
Guest
Posts: n/a
 
      01-08-2011
On Fri, 2011-01-07 at 17:08 -0800, linna li wrote:
> I tried to use the apscheduler and used the sample code below from the
> tutorial, but got the error message: Exception in thread APScheduler
> (most likely raised during interpreter shutdown). What's going on
> here? I really appreciate any help!
>
> from apscheduler.scheduler import Scheduler
>
> sched = Scheduler()
> sched.start()
>
> def some_job():
> print "Decorated job"
>
> sched.add_interval_job(some_job,minutes=1)


I see this same error when I run this code (python-2.6.5-3.3.1.x86_64)

I develop an application that uses APScheduler
<http://pypi.python.org/pypi/APScheduler/1.0>, the scheduler works very
well. But I haven't used it in exactly this manner.

If I add -
import time
time.sleep(300)
- to the end of your script I don't get the error; and the job actually
gets run [the scheduler thread won't stop the main thread, and thus the
script, from exiting].

The author of APScheduler has an eponymously named channel on FreeNode,
he can probably answer your question exactly.

 
Reply With Quote
 
Alice Bevan–McGregor
Guest
Posts: n/a
 
      01-08-2011
Howdy!

On 2011-01-07 17:08:28 -0800, linna li said:
> I tried to use the apscheduler and used the sample code below from the
> tutorial, but got the error message: Exception in thread APScheduler
> (most likely raised during interpreter shutdown). What's going on here?
> I really appreciate any help!


After talking a bit with Alex Grönholm it seems this is an issue raised
fairly often (not always in the context of this package) and is not
really a problem with APScheduler. It has far more to do with
attempting to start a thread, then immediately exiting the main thread.
That's not how threading is supposed to be used, so don't do it.

APScheduler 2.0 adds some improved examples, according to Alex, that
don't suffer the "problem" demonstrated by the short code snippit you
provided.

A package of mine, TurboMail, suffers from the same threading issue if
used improperly; you enqueue e-mail, it starts a thread, then you
immediately exit. TM tries to work around the issue, but in most cases
that workaround does not work properly. (You get strange uncatchable
exceptions printed on stderr though AFIK the e-mail does get sent
correctly, your application may hang waiting for the thread pool to
drain if you have a "minimum thread count" option set.)

I hope this clears things up a bit,

- Alice.


 
Reply With Quote
 
linna li
Guest
Posts: n/a
 
      01-11-2011
Thank you for all the replies here! I will try your suggestions.

On Jan 7, 11:03*pm, Alice Bevan–McGregor <al...@gothcandy.com> wrote:
> Howdy!
>
> On 2011-01-07 17:08:28 -0800, linna li said:
>
> > I tried to use the apscheduler and used the sample code below from the
> > tutorial, but got the error message: Exception in thread APScheduler
> > (most likely raised during interpreter shutdown). What's going on here?
> > I really appreciate any help!

>
> After talking a bit with Alex Grönholm it seems this is an issue raised
> fairly often (not always in the context of this package) and is not
> really a problem with APScheduler. *It has far more to do with
> attempting to start a thread, then immediately exiting the main thread.
> *That's not how threading is supposed to be used, so don't do it. *
>
> APScheduler 2.0 adds some improved examples, according to Alex, that



> don't suffer the "problem" demonstrated by the short code snippit you
> provided.
>
> A package of mine, TurboMail, suffers from the same threading issue if
> used improperly; you enqueue e-mail, it starts a thread, then you
> immediately exit. *TM tries to work around the issue, but in most cases
> that workaround does not work properly. *(You get strange uncatchable
> exceptions printed on stderr though AFIK the e-mail does get sent
> correctly, your application may hang waiting for the thread pool to
> drain if you have a "minimum thread count" option set.)
>
> I hope this clears things up a bit,
>
> * * * * - Alice.


 
Reply With Quote
 
linna li
Guest
Posts: n/a
 
      01-11-2011
On Jan 7, 11:03*pm, Alice Bevan–McGregor <al...@gothcandy.com> wrote:
> Howdy!
>
> On 2011-01-07 17:08:28 -0800, linna li said:
>
> > I tried to use the apscheduler and used the sample code below from the
> > tutorial, but got the error message: Exception in thread APScheduler
> > (most likely raised during interpreter shutdown). What's going on here?
> > I really appreciate any help!

>
> After talking a bit with Alex Grönholm it seems this is an issue raised
> fairly often (not always in the context of this package) and is not
> really a problem with APScheduler. *It has far more to do with
> attempting to start a thread, then immediately exiting the main thread.
> *That's not how threading is supposed to be used, so don't do it. *
>
> APScheduler 2.0 adds some improved examples, according to Alex, that
> don't suffer the "problem" demonstrated by the short code snippit you
> provided.
>
> A package of mine, TurboMail, suffers from the same threading issue if
> used improperly; you enqueue e-mail, it starts a thread, then you
> immediately exit. *TM tries to work around the issue, but in most cases
> that workaround does not work properly. *(You get strange uncatchable
> exceptions printed on stderr though AFIK the e-mail does get sent
> correctly, your application may hang waiting for the thread pool to
> drain if you have a "minimum thread count" option set.)
>
> I hope this clears things up a bit,
>
> * * * * - Alice.


I see the latest version is APScheduler 1.3.1. Where can I get
APScheduler 2.0?
 
Reply With Quote
 
Alice Bevan–McGregor
Guest
Posts: n/a
 
      01-11-2011
On 2011-01-10 17:23:34 -0800, linna li said:

> I see the latest version is APScheduler 1.3.1. Where can I get APScheduler 2.0?


https://bitbucket.org/agronholm/apscheduler/

I don't think 2.0 has been released yet, but that is the version number
in apscheduler/__init__.py on HG tip. The examples, BTW, just add
time.sleep() calls.

- Alice.


 
Reply With Quote
 
Hesham
Guest
Posts: n/a
 
      01-13-2011
In cases like that instead of sleep() can use pause(). E.g.,

from apscheduler.scheduler import Scheduler
import signal

sched = Scheduler()
sched.start()
def some_job():
print "Decorated job"
sched.add_interval_job(some_job,minutes=1)
signal.pause()

Mosalam
 
Reply With Quote
 
Aahz
Guest
Posts: n/a
 
      01-29-2011
In article <mailman.654.1294470254.6505.python->,
=?utf-8?Q?Alice_Bevan=E2=80=93McGregor?= <> wrote:
>
>A package of mine, TurboMail, suffers from the same threading issue if
>used improperly; you enqueue e-mail, it starts a thread, then you
>immediately exit. TM tries to work around the issue, but in most cases
>that workaround does not work properly. (You get strange uncatchable
>exceptions printed on stderr though AFIK the e-mail does get sent
>correctly, your application may hang waiting for the thread pool to
>drain if you have a "minimum thread count" option set.)


Why not write an exit handler that converts your thread to daemon? (Or
something like that.)
--
Aahz () <*> http://www.pythoncraft.com/

"All problems in computer science can be solved by another level of
indirection." --Butler Lampson
 
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
ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0xffc Thread 0x228 DBC 0x437b94 Jet'. ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr bazzer ASP .Net 0 03-30-2006 03:16 PM
Error connecting to SQLExpress 2005 locally (error: 26 - Error Locating Server/Instance Specified) hfk0 ASP .Net 2 03-27-2006 08:43 PM
ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0x8fc Thread 0x934 DBC 0x437b94 Jet'. ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr bazzer ASP .Net 1 03-24-2006 04:20 PM
ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0x8fc Thread 0x934 DBC 0x437b94 Jet'. ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr bazzer ASP .Net 0 03-24-2006 02:22 PM
Error 500: ERROR: Cannot forward. Writer or Stream already obtained. Error JavaQueries Java 1 03-01-2005 06:30 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