WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 06-16-2011, 09:38 AM
kevin kevin is offline
Member
 
Join Date: Jun 2011
Posts: 18
Current working directory in Vizard Executable

Hi all,

I'm building an executable in Vizard which at one point brings up a file browser, and I was hoping that the starting directory for this browser could be in the same directory as the executable being run. However, it seems that when Vizard publishes an .exe, it merely creates a wrapper around the python script which was being published. That script and the other necessary files (.pycs, etc) are then loaded into the AppData/Local/Temp folder of the current user, and so code like:

Code:
dir = os.getcwd()
and

Code:
if hasattr(sys, 'frozen'):
	dir = os.path.dirname(sys.executable)
only give me the directory for the Temp folder, rather than the directory of the actual executable file being run.

Is there any way around this?
Reply With Quote
  #2  
Old 06-16-2011, 09:40 AM
kevin kevin is offline
Member
 
Join Date: Jun 2011
Posts: 18
I should also mention that the if-statement in the second block of code isn't even evaluated to be true, since a .py script is technically still being interpreted. The sys module is not frozen.
Reply With Quote
  #3  
Old 06-16-2011, 10:07 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
You can use the viz.res.getPublishedPath command to get the directory of the published executable.
Reply With Quote
  #4  
Old 06-16-2011, 11:31 AM
kevin kevin is offline
Member
 
Join Date: Jun 2011
Posts: 18
Worked perfectly, thank you very much!
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Vizard 4 Beta Testing farshizzo Announcements 0 02-01-2011 10:46 AM
Vizard 4 Beta Testing farshizzo Vizard 0 02-01-2011 10:46 AM
Vizard tech tip: Using the Python Imaging Library (PIL) Jeff Vizard 0 03-23-2009 11:13 AM
Tickle2 Demo not working in Vizard 3.0 mjabon Vizard 7 01-07-2008 03:59 PM
Fall 2007 release of Vizard R3 3 D Announcements 0 10-15-2007 04:50 PM


All times are GMT -7. The time now is 06:14 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Copyright 2002-2018 WorldViz LLC