Message 1 of 5
Runtime error: Storage cannot be opened for write

Not applicable
10-16-2018
11:46 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am ultimately trying to call CustomFileStream.writeStream.
<bool>writeStream <filename>fileName <string>streamName <string>content persistent:<bool> noLoadOnSceneLoad:<bool> append:<bool> persistent default value: true noLoadOnSceneLoad default value: false append default value: false
However, I am getting this error:
Runtime error: Storage cannot be opened for write: <my filepath>
I have tried running 3DSMax in administrator mode, and I have tried opening a file with a "w+" mode, but that only produces other errors. Any help would be appreciated. My script is below:
utility testDataStream "Test Data Stream" ( Global Dir, new_file button testButton "Test Data Stream!" button choose_directory "Save file as..." on choose_directory pressed do ( print "choose directory" Dir = getSaveFileName caption:"streamData..." \ types:"Text (*.txt)|*.txt|Excel(*.csv)|*.csv|All Files (*.*)|*.*" \ historyCategory: "Previus Path Save file..." print "print directory:" print Dir ) on testButton pressed do ( try ( new_file = createfile Dir --filename = getOpenFileName types:"*.txt" print "post filename" --opened_file = openFile filename mode:"w+" print "opened the file" if(new_file != undefined) do ( format "testing file stream...\n" to:new_file --filename = getFileAttribute new_file #directory print "write to the stream!" directory = Dir as string --print opened_file CustomFileStream.writeStream directory "testDataStream_param" "my content" persistent:false noLoadOnSceneLoad:false append:false ) ) catch ( format "*** % ***\n" (getCurrentException()) print "error in creating/writing to file" ) print "done" )
My program output currently is
"post filename" "opened the file" "write to the stream!" *** -- Runtime error: Storage cannot be opened for write: C:\Users\...\test25.txt *** "error in creating/writing to file" "done"