As a first step, I used Excel to create a test CSV file with two sentences that was saved on the disk drive in the Pharo working directory. I have subsequently tried to import the sentences into Pharo 6.1 32 bit stable. This was done as follows. |workingDir reader result| workingDir := FileSystem disk workingDirectory. myFileName := 'MoonCSV.csv'. stream := workingDir/myFileName readStreamDo: [ :stream |
stream contents]. reader := (NeoCSVReader new) separator: Character cr. The separator was changed from a comma to a cr because the inspector showed a cr, not a comma separating the two imported sentences. result := (reader on: stream). result upToEnd. Instance of ByteString doesn’t understand #atEnd. I don’t see how to proceed further. Also I am not clear on the best way to export the sentence and tags to the disk drive.. Any help would be appreciated. Lou Cleveland
|
Hi, > Instance of ByteString doesn’t understand #atEnd. This is a very typical error when you have accidentally passed a String instead of a Stream. ... which you did here: > stream := workingDir/myFileName readStreamDo: [ :stream | stream contents]. You can either operate directly on the file stream, e.g. file := 'D:\tmp\rules.csv' asFileReference. result := file readStreamDo: [ :stream | |reader| reader := NeoCSVReader new. reader on: stream. reader upToEnd. ]. Or if you already have a string, then ask it for its readStream file := 'D:\tmp\rules.csv' asFileReference. contents := file contents. reader := NeoCSVReader new. reader on: contents readStream. reader upToEnd. On Mon, Nov 26, 2018 at 11:27 PM William L. Cleveland <[hidden email]> wrote:
|
Free forum by Nabble | Edit this page |