|
#1
|
|||
|
|||
Publish as EXE - Introduction
Available starting R3 Beta 2
Publishing your simulation as an executable is a new bundled feature that “compiles” your simulation—including all scripts and resource files—into a single .EXE package. The compiled package will work as a fully functional Vizard development environment with the notable difference being that it can run on any machine now without installing Vizard first. There is a restriction, though; “compiled” simulations cannot be edited or modified (i.e., scripts or resource files changed) without recompiling on a licensed Vizard development machine. Accessing and using this feature is easy as it’s built into the Vizard development environment. Under the file menu, you’ll now find “Publish as EXE…”. A Wizard will walk you through the necessary steps. The compiler has two steps; the first requires that you run your script so that all dependencies (across your project files, Vizard modules, Python, etc) can be identified. Second, it compresses everything together into a single EXE that can be distributed royalty-free. Other limitations:
|
#2
|
|||
|
|||
Running EXEs on machines w/previous R2 installations
If you attempt to run a R3 published EXE on a machine that has had R2 installed but never R3 installed, then the EXE will not function correctly and will produce a number of errors. R2 unfortunately defined itself in the system path and this collides with R3. The R3 installer removes this entry from the system path.
To remedy this, either install R3 Beta or manually remove "c:\program files\vizard25" from you system's PATH environment variable. |
#3
|
|||
|
|||
publishing as exe
Hi-
We've tried publishing as EXE on a couple computers and we can't seem to get it to work (even with a bare-bones script). I get to the point of running the program within the Publish as EXE dialogue box but then when I close the script, the process fails. The two computers I've tried this on have 2.53 on them, if that matters. -Cade |
#4
|
|||
|
|||
Hi Cade,
are you sure that either R3 is installed and/or "c:\program files\vizard25" is removed from you system's PATH environment variable? Please have a look at the previous post and the implications of an R2 installation on running an executable on a computer. Hope this helps. |
#5
|
|||
|
|||
writing a text file
Hi-
I want the exe I've made with Publish to EXE to write to a text file for recording data. Is that possible? Thanks, Cade |
#6
|
|||
|
|||
Yes, it should be possible. Did you have a problem trying it?
|
#7
|
|||
|
|||
No. When I publish this script as an exe . . .
import viz viz.go() file = open( 'test.txt', 'a' ) file.write( 'hello' ) file.close() . . . I can't get the exe to write anything. |
#8
|
|||
|
|||
Keep in mind that published EXEs are extracted to a temporary directory then executed from there. So the file is probably being created in that temp directory, which gets deleted after your script exits. I'm assuming you want the file to be created in the same directory as the EXE? Here is sample code that does this:
Code:
import viz viz.go() #Get path to publish EXE path = viz.getOption('viz.publish.path','.')+'/' #Open file in path file = open( path + 'test.txt', 'a' ) file.write( 'hello' ) file.close() |
#9
|
|||
|
|||
Perfect. Thanks.
|
#10
|
|||
|
|||
I'm having the same problem... I tried what you said and it works for when I'm running the script inside Vizard, but not when I'm running it as a published EXE. It creates instead a blank document named whatever I named it... am I doing something wrong?
|
#11
|
|||
|
|||
This happened when you published the short script posted here?
|
#12
|
|||
|
|||
Hmm it works when I try to run just the script posted here... just not when I try to put it into my own script
|
#13
|
|||
|
|||
I'm just going to slide into this conversation and add my problem with publishing instead of making a new topic.
I'm using the module xml.dom.minidom but when I publish an exe and try to run it on an other computer, the exe is unable to find this module. The publish as exe wizard found a dependancy for minicompat.pyc but having it included does not change anything. I noticed that the minidom.py didn't have it's own .pyc file so I tried manually compiling one and included in the list of dependencies. This didn't change anything either. Being fairly new to Python I'm not entirely sure how the structuring works for the .pyc-files. The minidom is importing other modules from the xml.dom namespace, do I need to create .pyc files for all of those as well? Or are they recursively bundled toghether inside the minidom.pyc? |
#14
|
|||
|
|||
A fresh install and the problem is no more. Thanks.
|
|
|