PDA

View Full Version : Publishing Error


hotshotiguana
04-04-2012, 12:52 PM
When I run my script using the Vizard 4.0 Enterprise console, I do not get any errors, but when I compile and publish the script to an EXE file and run the script it shuts down without any warning.

I researched it a bit and found the exact line that is causing this problem:
import datetime
open_date = datetime.datetime.strptime("2012-04-04", "%Y-%M-%d").date()

Does anyone have any idea why this line would work in the Vizard console but not in my published exe file?

Thanks,
Chris

farshizzo
04-04-2012, 04:40 PM
I'm not sure why that line would cause an error. I just tried publishing the following script to an EXE and it worked fine on my machine:import viz
viz.go()

import datetime
open_date = datetime.datetime.strptime("2012-04-04", "%Y-%M-%d").date()

viz.add('gallery.osgb')
Does this script work for you? How did you determine that line was causing the error?

hotshotiguana
04-04-2012, 05:02 PM
That script works fine when I run in the console and when I compile it.

I kept trying to comment out different lines in my script to see what was causing the problem and eventually when I commented out only that line the executable script started to work. I also placed pop-ups before and after that line and the software exited before it reached the second pop-up. Could the problem be that this specific line of code is not run until the second time a user opens the software (the import statement is at the top of my code, so I know that datetime is imported)?

I know this is a vague question because you don't exactly know any other features of my script, so to be more general is there a way to debug a script to test if it will work when compiled as an executable? I have also had this problem before with a Matplotlib toolbar for wx that loaded fine when I was working in the console and then failed to work when I compiled the script.

Thanks