IOException error -1407

IOException is back (or a bit more of it)

Xojo 2015r1
El Capitan .2

I already told you about the IOException I got when trying to save a file using BinaryStream.

Of course, because I am coming back here, I am not satisfied with the answers I got.

I was also a bit angry and wanted to know what happens.

Minutes ago, I called into that trap, again. I had Xojo (2015r1) open, TextEdit, Preview (some other ?); FireFox and/or Safari was also at a time in that open session was launched, but close before the crash occurred.

It was a crash that happens after only a couple of minutes and a some (around 10) changes, I wanted to save the ‘new’ file contents and get that crash.

I ran the project in Xojo’s IDE, redo the same changes (since I recall what change I’ve done…), then I quit every application and shutdown the laptop.

After dinner, I power on my MacBook Pro, run the application (the one who crashed earlier with an IOException), load a cvs file and try to export it: I added a suffix to not write over the original file.

I got a new file.

So, the problem is somewhere, but where, why and most important: is there’s a bug in my project ?

For the later question, I do not get an IOException when I was running the project in the IDE. My next move will be to build a brand new standalone (still with 2015r1) and work with this application (but I will keep the two occurrences of the same build, just in case).

[Late Breaking News]

  1. I had a crash minutes ago (IOException error number: -1407). The conditions were:

• Standard boot,
• run from the latest project,
• run a previous version (so I can merge some cvs files)
• drop the files onto the application(s) icon(s),
• copy / paste between both applications.

At last, export as cvs and the screen shot below appears. I will restart that and copy the whole new data contents before trying to save the new data (and try to paste it after a reboot)…

  1. I dropped onto the icon of the latest stand alone a cvs file and tried to save it: I got the crash… [TextEdit launched]. I tried to save the data loaded in the old stand alone: no crash !
    Why so much hate ???

I rebuild the compilation of my six files into one (load files one at a time, copy / paste: copy the whole, Save, IOException THEN at save time. I pasted the whole into the old stand alone and save: it worked. The old stand alone who do not worked yesterday !!!

Last clue: I load the brand new stand alone, pasted the whole data into the front window, Export: I got the file without crash. differences with all previous attempts: I use only one paste into the application AND this time (unlike the first try), the new stand alone is launched after the old standalone.

Time for breakfast (and calm my hungry / cool my anger…).
[/Late Breaking News]

Nota: I used the project running it in the IDE intensively to import data (file names) from a specific folder that are NthFielded [!] and placed into a ListBox, then saved to disk as txt, then loaded into the same project, different window and modified at will (go to the Finder, modify one or many file names, back to the list and search anomalies, etc.
I also made many adjustments on the way the data from the file names are set into the ListBox at read time.

So, I had occasions to get IOExceptions, in the two or three hours I was working with these data. I also appended a lot of txt files in a ListBox without troubles.

I nearly forgot: both the Xojo project and the folders I was working on are located in an external hard disk (WD Elements 2TB with 2 partitions), the txt files are stored in the internal SSD.

PS: I am working with 2,000 (3,000 ?) files, but only four fields (plus the file extension and file size) in each file name. The process I follow is faster than checking using the eyes all these file names to search a double space, a missing space in the field separators (" - " without the quotes). An error in the file name is easy to get following these operations. Also, it is good to have this to do: it help me checking my code to dispatch the data into the ListBox.

The csv file have actually 1,236 Rows (on 8 columns, three of them holds dates: 10 chars long…)

Almost certainly.
Your post is long and a little difficult to follow, but it sounds like you are opening a file, and then saving it again?
When you save, something stops that from happening.
But it works if you use a new file name?

That suggests that the old file is still ‘open’ (either in your program or another) at the time you try to save.

Check the code you use to open the file.
Make sure every open command is matched by a suitable ‘close’ when you have finished reading from the file.

Perhaps read the whole file into memory and close it in a single method
Then work on the memory copy
Then save from memory in a single save method when you are done?

Hi Jeff,

what a fast answer.

New file name.

I do not found a “reliable” way to set the IOException. The same application used with the same laptop, files, etc. will fall into the bug… or not !

The open and save (export, whatever) methods are … methods, so even without checking, I can say this is not a sort of file still open (and I save using a different name, sometimes location).

One thing I was thinking at was the use of teh Clipboard / the number of times I use copy / paste (I was driving when this comes to mind, I will check).

And, after all, why an application works fine now and not in some minutes (hours…) and the reverse (why this does not worked early in the morning when it was working fine later the previous evening).

[quote=241252:@Jeff Tullin]Your post is long and a little difficult to follow, but it sounds like you are opening a file, and then saving it again?
When you save, something stops that from happening.
But it works if you use a new file name?[/quote]
I add data in the ListBox, then I try to save the whole using a suffix (a, b, c…) to the file name to get a backup (in case of something wrong either in the save process or because I make errors in adding / change data).

Sorry for the difficult reading. If I only stated the essential, I will get all sort of answers I already checked, already get in my prior attemps (conversations here). I even have code request. How code can be executed differently on different run ? (and even if in practice, this happens :frowning: ).

It took me a while to find the ‘other’ post, and I see the same information was added to that one.
If we trust that

  • you are closing the file.
    -you have not opened it in Preview
    -you are opening a file that ends with .txt and saving one that ends with .csv
    -you are not saving a second file ending .csv with the same name as the last one

then perhaps the problem lies with the other comment you made

’ until the next day I connected my all purpose external HD: the contagion resumed.’

Contagion is not ‘the correct word’, but it suggests a hardware or software fault is occurring?

You said

[quote]I nearly forgot: both the Xojo project and the folders I was working on are located in an external hard disk (WD Elements 2TB with 2 partitions), the txt files are stored in the internal SSD.

So put the project (or compiled app) and the folders onto your actual laptop, and do it all there, as a test.
Or try a different machine.
Maybe there is a bottleneck/delay when writing to the external hard drive, maybe the SSD is close to breaking…

Good sugegstions !

Will try it. Both applciations are already in the internal SSD and I think the data too, but doing a test without the external HD will take a bunch of minutes: I can do it.

I can also do that, but on a Windows 8.1 laptop. (I can do it on an old MacBook Pro, but I do not know when.)

Part 1: I was thinking so, but no idea on how to test that (excepted removing it).
Part 2: SSD close to break ? Why not, even if the laptop have only 13 months…
I can do another test booting on my El Capitan beta hard disk.

Back in time: because the early problem with IOException stopped sometimes after my first Conversation on the subject, I also stopped to worry about it 'till yesterday.

I have testings on my plate for this afternoon.


Simple test done seconds ago [no external HD, only the internal boot SSD]:

At last, I was able to save 55,440 Rows (from the ListBook).

I took two lines with some columns (data I had in an open TextEdit document) and paste them / save to file under new name (around 10 times adding two row at a time).

Then I copy the whole ListBox contents and add it to the ListBox / save some times until I get that amount of Rows (I report the number of Rows in a TextField at the window’s bottom with the selected Row [or the first of the selected Rows]).

I saved the files in the same folder where the application actually resides… The application resides in a sub-folder that is inside the Applications folder (Applications::Standalone).

No Crash.

I have TextEdit, FireFox and Safari open, I am downloading 3 files. The external hard disk was connected earlier (no reboot since) and I eject the two partions minutes ago (before running the application).

I nearly forgot: I do not have any non ASCII characters in the application path (Boot Hard Disk 'til the application name). That matters.

I will eat my hat / pull my hairs / whatever…

I think that I got something:

I loaded a text file, then changed the \tab with a comma (with TextEdit, I do not closed the file), then load the newly saved .txt file (it loaded fine) and tried to save it as csv: crash !

I have ways to explore now.

When you say
‘and tried to save it as csv’

How do you save it as CSV?

Do you take the original folderitem and use that? eg (pseudocode)

[code]dim f as folderitem as text file, do something with it
F.close = new name ending with .CSV

If you do that (changing the name of the original file), then it is still the same file.
Try something like

[code]dim f as folderitem as text file, do something with it

dim f2 as folderitem = similar name but ending with .CSV

If you do that, you will have both the original and a new file.
You can always delete the original if you wish.

Why do you do the ‘replace’ using TextEdit?
if you read the whole file as a string, you can use ReplaceAll in Xojo before you start working on the text…