WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 09-19-2014, 10:05 AM
mshukun mshukun is offline
Member
 
Join Date: Jan 2013
Posts: 32
EXE creating a new folder

I have a problem creating a folder after compiling the code. The code below (1) creates the 'output.wav' file in the same directory as exe file. However, I would like to create "recording" folder to store the 'output.wav' file when the folder doesn't exist. How can I achieve it?

Thank you in advance.
Makiko


------------------------------------
(1) viz.res.getPublishedPath('output.wav')


Code:
# This code doesn't work after creating exe file.
curDir = os.path.dirname(os.path.realpath(__file__))
		recfileDir = os.path.join(curDir, "recording")
		if not os.path.exists(recfileDir):
			os.makedirs(recfileDir)
Reply With Quote
  #2  
Old 09-19-2014, 10:25 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
You can use the viz.res.getPublishedPath command to determine the EXE execution path. You can use this to create files and subfolders. Here is an example:
Code:
# Get and create recording directory
recordingPath = viz.res.getPublishedPath('recording')
if not os.path.isdir(recordingPath):
	os.makedirs(recordingPath)

# Output file to recording directory
outputPath = os.path.join(recordingPath,'output.wav')
with open(outputPath,'wb') as f:
	f.write('')

Last edited by farshizzo; 09-19-2014 at 10:27 AM.
Reply With Quote
  #3  
Old 09-23-2014, 06:40 AM
mshukun mshukun is offline
Member
 
Join Date: Jan 2013
Posts: 32
Thank you so much!! It worked perfectly!!

Makiko
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
Creating a new DLS in trial license jmay Plug-in development 3 04-30-2014 09:30 AM
Creating Realistic Turns in Vizard using walkTo mikeb Vizard 1 02-28-2014 05:51 AM
Creating objects with VizLayers and returning creates duplicates....? Nyhood Vizard 1 09-11-2013 01:41 PM
Creating a road Saz Vizard 3 11-14-2008 03:45 AM
PeopleMaker - creating morphs vjonshih Vizard 4 01-02-2005 04:30 PM


All times are GMT -7. The time now is 01:47 AM.


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