So the problem i'm having with these libraries is that when i try and compile the python script with cx_freeze if I have version 3 of APscheduler it refuses to compile
error message:
"ImportError: No module named 'apscheduler.executors.base_py3'"
and when I try compile it with the 2.1.2 version it compiles but when run throws an error saying it cant import from apscheduler.schedulers.blocking import BlockingScheduler
does anyone know a way around this or have a solution?
code below:
import gspread, time, requests
from oauth2client.service_account import ServiceAccountCredentials
from apscheduler.schedulers.blocking import BlockingScheduler
def update():
print("used")
scope = ['https://spreadsheets.google.com/feeds']
creds = ServiceAccountCredentials.from_json_keyfile_name('details.json', scope)
client = gspread.authorize(creds)
sheet = client.open('ip_display').sheet1
userip = (requests.get("http://jsonip.com/").json())["ip"]
row = [userip, ]
sheet.update_cell(2, 1, userip)
sheet.update_cell(2, 2, time.strftime("%H:%M:%S"))
scheduler = BlockingScheduler()
job = scheduler.add_job(update, 'interval', hours=1)
scheduler.start()
cx_freeze relies on heuristics to determine which modules to include and what not to. This fails with APScheduler since it relies on entry points (and thus dynamic imports). Therefore you must explicitly add the apscheduler package to cx_freeze's list of required modules.