PDA

View Full Version : problems with output to a text file within executable


Saz
07-01-2009, 06:05 AM
Hi,

I'm having trouble getting my data when my program is published as an executable. When developing the code this:

#Get path to publish EXE
path = viz.getOption('Y:\backup\Vizard30\resources\road\s peed_.txt','.')+'/'

#Open file in path
file = open( 'adapt' + str(subject),'w' )

worked fine - but didn't work at all when published as an executable.

Previously I've gathered data using this:

directory = 'Z:\Vizard30\Dataoutput\driving\ '
subjectd = 'speed_.txt' + str(subject)
filename = directory+subjectd
file = open(filename, 'w')

which again seems to have stopped working.

I've tried this:

def getPublishedPath(filename):
filename = 'adapt_.txt' + str(subject)
publishPath = viz.getOption('Y:\backup\Vizard30\resources\road\' ,'')
if publishPath:
return '/'.join([publishPath,filename])
return filename

file = open(getPublishedPath(filename), 'w')


but I get an error message with it.

Any ideas on what I should be doing?
Cheers!

Jeff
07-01-2009, 11:01 AM
Take a look at the following thread. There's some sample code in one of farshizzo's posts.

http://forum.worldviz.com/showthread.php?t=715