View Single Post
Old 07-01-2009, 06:05 AM
Saz Saz is offline
Join Date: Nov 2008
Posts: 36
problems with output to a text file within executable


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\speed_.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?
Reply With Quote