new installl fails to run script with apscheduler

1,613 views
Skip to first unread message

gne...@googlemail.com

unread,
Sep 16, 2014, 4:02:49 PM9/16/14
to apsch...@googlegroups.com
After (re)installing Raspberry/Weezy on a brand new SD-card I need to run a python script
with APScheduler.
The script fails with
  File "piSchedule.py", line 51, in <module>
   from apscheduler.scheduler import Scheduler
ImportError: No module named scheduler

Line #51 has:
from apscheduler.scheduler import Scheduler

The same python script runs without problem based on previous install, so it's unclear for me why it's failing.

Details about the installation:
$ sudo easy_install apscheduler
Searching for apscheduler
Reading http://pypi.python.org/simple/apscheduler/
Best match: APScheduler 3.0.0
..etc ..
Installed /usr/local/lib/python2.7/dist-packages/six-1.8.0-py2.7.egg
Finished processing dependencies for apscheduler
$


Python is
$ python
Python 2.7.3 (default, Mar 18 2014, 05:13:23)
[GCC 4.6.3] on linux2


Any help?

Alex Grönholm

unread,
Sep 16, 2014, 4:26:30 PM9/16/14
to apsch...@googlegroups.com
16.09.2014, 23:02, gne...@googlemail.com kirjoitti:
After (re)installing Raspberry/Weezy on a brand new SD-card I need to run a python script
with APScheduler.
The script fails with
  File "piSchedule.py", line 51, in <module>
   from apscheduler.scheduler import Scheduler
ImportError: No module named scheduler

Line #51 has:
from apscheduler.scheduler import Scheduler

The same python script runs without problem based on previous install, so it's unclear for me why it's failing.
It seems like your code was made for APScheduler 2.x. Then you installed APScheduler 3.0. APIs sometimes change with major releases, and this happened in the 3.0 release too. That is why your code failed. So either install an earlier version or (preferably) update your code for the 3.0 API. There are helpful instructions for that in the documentation.

Details about the installation:
$ sudo easy_install apscheduler
Searching for apscheduler
Reading http://pypi.python.org/simple/apscheduler/
Best match: APScheduler 3.0.0
..etc ..
Installed /usr/local/lib/python2.7/dist-packages/six-1.8.0-py2.7.egg
Finished processing dependencies for apscheduler
$


Python is
$ python
Python 2.7.3 (default, Mar 18 2014, 05:13:23)
[GCC 4.6.3] on linux2


Any help?

--
You received this message because you are subscribed to the Google Groups "APScheduler" group.
To unsubscribe from this group and stop receiving emails from it, send an email to apscheduler...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

gne...@googlemail.com

unread,
Sep 17, 2014, 8:05:30 AM9/17/14
to apsch...@googlegroups.com
Am Dienstag, 16. September 2014 22:26:30 UTC+2 schrieb Alex Grönholm:
...

It seems like your code was made for APScheduler 2.x. Then you installed APScheduler 3.0. APIs sometimes change with major releases, and this happened in the 3.0 release too. That is why your code failed. So either install an earlier version or (preferably) update your code for the 3.0 API. There are helpful instructions for that in the documentation.

...

Not that much amusing! 
No question improvements are always welcomed. But one major aspect of APIs should be: giving a smooth upgrade path and some way of backward compatibility. And yes, that's not always possible. So a good instruction how to migrate to the new API is essential. Have to say, that's not the case here! You write "There are helpful instructions" .. fmpov it's not the case!

After changing for
#from apscheduler.scheduler import Scheduler
from apscheduler.schedulers.background import BackgroundSch
eduler
and also sched = BackgroundScheduler() the next problem is with
AttributeError: 'BackgroundScheduler' object has no attribute 'add_date_job'
 ... and -- sorry -- where is a description how to migrate 'add_date_job'

Maybe you have time to give some more descriptive migration help on your docs.

Thanks
 

Alex Grönholm

unread,
Sep 17, 2014, 8:08:06 AM9/17/14
to apsch...@googlegroups.com
Right here:
  • The trigger-specific scheduling methods have been removed entirely from the scheduler. Use the generic add_job() method or the scheduled_job() decorator instead. The signatures of these methods were changed significantly.

Maybe you have time to give some more descriptive migration help on your docs.

Thanks
 

gne...@googlemail.com

unread,
Sep 17, 2014, 8:14:24 AM9/17/14
to apsch...@googlegroups.com
Just to document what I'm speaking about.

  File "piSchedule.py", line 239, in pilightSchedule
    jobs.append(sched.add_job(fire_pilight, str(xTime), [message + "|" + info], name=jobName))
  File "/usr/local/lib/python2.7/dist-packages/APScheduler-3.0.0-py2.7.egg/apscheduler/schedulers/base.py", line 330, in add_job
    'trigger': self._create_trigger(trigger, trigger_args),
  File "/usr/local/lib/python2.7/dist-packages/APScheduler-3.0.0-py2.7.egg/apscheduler/schedulers/base.py", line 782, in _create_trigger
    return self._create_plugin_instance('trigger', trigger, trigger_args)
  File "/usr/local/lib/python2.7/dist-packages/APScheduler-3.0.0-py2.7.egg/apscheduler/schedulers/base.py", line 766, in _create_plugin_instance
    raise LookupError('No {0} by the name "{1}" was found'.format(type_, alias))
LookupError: No trigger by the name "2014-09-17 22:50:00" was found

Alex Grönholm

unread,
Sep 17, 2014, 8:16:21 AM9/17/14
to apsch...@googlegroups.com
Given that it's a new API, I expected users to at least give a cursory look at the API documentation of add_job() after the upgrade to a new major version. Especially if they get an exception. I guess I was wrong.
Reply all
Reply to author
Forward
0 new messages