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

Hi,

I'm having trouble getting my data when my program is published as an executable. When developing the code this:
Code:
#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:
Code:
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:
Code:
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!
Reply With Quote