buzzard51
buzzard51

Reputation: 1477

import errors in python - apscheduler

Attempting to run a python script for raspberry pi - xbee home automation:

from xbee import zigbee
from apscheduler.scheduler import Scheduler
import time
import serial
import Queue

My specific problem is importing from apscheduler here:

from apshceduler.scheduler import Scheduler
ImportError: No module named Scheduler

This is usually either 1) a capitalization error in the import name, 2) library is not installed, or 3) wrong version of library. For instance, the interpreter complained about the zigbee import because the original script had it capitalized.

The bigger question is, once a python library is installed (apscheduler in this case), how can I tell what imports are available instead of repeated guesses in the python script? Is there a python command that lists installed libraries, their versions, and the available imports?

Upvotes: 1

Views: 1242

Answers (2)

Alex Grönholm
Alex Grönholm

Reputation: 5911

That script was written for the pre-3.x API of APScheduler. So either install an earlier version of APScheduler or fix the script to use the newer API.

Upvotes: 1

ThePavolC
ThePavolC

Reputation: 1738

As @josebama mentioned, it is apscheduler.schedulers, you can have a look at all modules here.

About checking if library is installed, just run python from command line, then try to import library with import apscheduler.

Upvotes: 1

Related Questions