WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 10-01-2003, 05:10 PM
FlyingWren FlyingWren is offline
Member
 
Join Date: Mar 2003
Location: Fargo, North Dakota, USA
Posts: 48
Closing file handles from within function

Closing file handles works fine if I don't do it from within a function call.

Consider the following, though. I press a key, and the "file should be closed now" line appears. But, the file doesn't seem to close-- it can't be renamed or deleted without first exiting the program that created it (ie, Vizard).

am I missing something?

Code:

import viz
viz.go()

fileOutput = open(hi.txt', 'a')
fileOutput.write('hi there\n')

def mykeyboardfunc(key):
	fileOutput.flush()
	fileOutput.close()
	print "file should be closed now"
	
viz.callback(viz.KEYBOARD_EVENT, mykeyboardfunc)
Reply With Quote
 

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


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


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