| Not getting much attention on stack overflow so I thought I would post here..... http://stackoverflow.com/questions/17024583/python-apscheduler-error-calling-script I dont want to regenerate it all here...but the basics are... I have a script that runs fine from the command line but when called from APScheduler it gives me
|
It seems like your "getandstore.py" has an error -- you are
attempting to invoke pymssql.connect() without having imported
pymssql.--
Bill
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/groups/opt_out.
I'd also like to point out two other things:
1. Busy-waiting with a while: True loop is bad (it uses up lots of
CPU cycles for no reason) -- use the standalone mode instead
(assuming APScheduler 2.1.0)
2. It'd usually be preferable to either import your module
(getandstore.py) instead, or use the subprocess module to execute
it. The execfile() call executes the code in-place.
I have seen. This behavior before. I think I am just going to do imports from within the function from here on out.
Thanks,
Doc
1. Will read up on that and implement.
2. Yes, I think it is odd to use exec. I am only less than a year into python so there are quite a few things I don't get. One is executing a complete script within a script. I can execute a function from another script (obviously) but haven't quite figured out how to execute the whole script. I suspect it is that "if __main__" stuff making the main part of the script into a callable function...will work on it. Thus far my elementary approach has gotten the job done....although I am sure their are downsides so will try to figure that out.
Appreciate your help.
Doc
ok on 2... i did that this way:
#testscript.py
def calledscript():
print 'called part'
def main():
print 'main part'
calledscript()
if __name__ == "__main__":
main()
then from scheduler:
from testscript import main as testscript
then put "testscript" in my scheduler line.
That works but I think I am missing something on the way I am importing it (seems clunky) but if i import it directly I have to call testscript.main() which sucks but might be the right way to do it.
I am not grasping how to do the APScheduler standalone. I will have to play around. It seems when I have tried this in the past and I run scheduler it drops straight through the program and terminates but I may have thought it wasnt running but it was. that was a couple months ago. It seems like I wrote a simple start script and a stop script.
Insight is appreciated.
I thought about that shoulda done it... here you go.. appreciate the insight.
You received this message because you are subscribed to a topic in the Google Groups "APScheduler" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/apscheduler/O9J6nU6r6F4/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to apscheduler...@googlegroups.com.
--
You received this message because you are subscribed to a topic in the Google Groups "APScheduler" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/apscheduler/O9J6nU6r6F4/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to apscheduler...@googlegroups.com.
SQLALchemy looks a little rought connecting to MS SQL server.. ODBC drivers and on and on..what does this do? Any reference on al l this? I am not advanced enough to do a bunch of configuration...sorry for off topic