#1
|
||||
|
||||
EOF error
Hi,
I'm not axactly an experienced programmer, but I do make a Lisp tool in OSD every now and then. That's why I used Lisp to make an analysis tool for a whole bunch of csv-files made by an oscilloscope. The tool works fine, except for the fact that I get this error: LISP error: Unexpected end of #<string-input stream from " ">. I suspect that it's something with linefeed characters or the like, because if I delete the last line of each file, it works correctly. But because I have to work through a pile of csv files, it's no fun to have the error all the time. Is there a way to prevent this?? See aattached lisp-file and (partial) example csv-file (please rename to .csv!!). Thanks! Regards, Jaap |
#2
|
||||
|
||||
Re: EOF error
I answer without executing the file(s)
have a look to the last line: PHP Code:
PHP Code:
Do you know about 'trace' ? .. if not learn about it, e.g. at: How can I trace function call (written by Claus) When tracing you'll see that calling read-from-string makes the lisp error. You have to decide what to do if there's an empty string! a) use IKIT function sd-read-from-string, then the LISP error does not appear b) (if (zerop (length (third regel))) (setf z :invalid) (setf z (read....))) You as the programmer have to handle this situation. include in your testdata: E+00,8E-02,1.53E-01,5.080E+00 2,3,4, aa,42,"","88",8.2 wirte one function handling this stuff and call it X times e.g. : (defun number-extract (list index) ....) This function returns a number in every case.. as fall back 0.0 Then the rest of your code should be able to handle a zero.
__________________
|
#3
|
||||
|
||||
Re: EOF error
Hi,
thanks a lot! I should have checked better what causes the error... I know where to look now Kind regards, Jaap |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|