Hi Sven, There is apparently a problem in NeoCSVReader. #codepoint is apparently missing The following code raises an exception: urlAsString := 'http://bit.ly/exampleCSV'. content := (ZnEasy get: urlAsString) contents readStream. lines := (NeoCSVReader on: content) skipHeader; upToEnd. I loaded NeoCSV using: Gofer new smalltalkhubUser: 'SvenVanCaekenberghe' project: 'Neo'; package: 'ConfigurationOfNeoCSV'; load. (Smalltalk at: #ConfigurationOfNeoCSV) loadBleedingEdge. Any idea? Cheers, Alexandre
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. |
> On 09 May 2016, at 15:26, Alexandre Bergel <[hidden email]> wrote: > > Hi Sven, > > There is apparently a problem in NeoCSVReader. #codepoint is apparently missing > The following code raises an exception: > > urlAsString := 'http://bit.ly/exampleCSV'. Can you give me a working URL so that I can try myself ? > content := (ZnEasy get: urlAsString) contents readStream. > lines := (NeoCSVReader on: content) > skipHeader; > upToEnd. > > > I loaded NeoCSV using: > Gofer new > smalltalkhubUser: 'SvenVanCaekenberghe' project: 'Neo'; > package: 'ConfigurationOfNeoCSV'; load. > (Smalltalk at: #ConfigurationOfNeoCSV) loadBleedingEdge. > > Any idea? > > Cheers, > Alexandre > -- > _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: > Alexandre Bergel http://www.bergel.eu > ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. > > > |
Oops… You’re right.
Sorry about that Alexandre
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
|
> On 09 May 2016, at 16:29, Alexandre Bergel <[hidden email]> wrote: > > Oops… You’re right. > Sorry about that No problem. Actually, many people use ZnEasy because it seems simple, but it can be deceiving (like in this case). If you want the shortest possible code in scripting I would suggest doing it like this: 'http://bit.ly/exampleCSV' asUrl retrieveContents. 'http://zn.stfx.eu/zn/numbers.txt' asUrl retrieveContents. The #retrieveContents message will fail unless there is a proper HTTP 200 OK response. And it is all cool unary messages ! > Alexandre > -- > _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: > Alexandre Bergel http://www.bergel.eu > ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. > > > >> On May 9, 2016, at 10:28 AM, Sven Van Caekenberghe <[hidden email]> wrote: >> >> >>> On 09 May 2016, at 15:26, Alexandre Bergel <[hidden email]> wrote: >>> >>> Hi Sven, >>> >>> There is apparently a problem in NeoCSVReader. #codepoint is apparently missing >>> The following code raises an exception: >>> >>> urlAsString := 'http://bit.ly/exampleCSV'. >> >> Can you give me a working URL so that I can try myself ? >> >>> content := (ZnEasy get: urlAsString) contents readStream. >>> lines := (NeoCSVReader on: content) >>> skipHeader; >>> upToEnd. >>> >>> >>> I loaded NeoCSV using: >>> Gofer new >>> smalltalkhubUser: 'SvenVanCaekenberghe' project: 'Neo'; >>> package: 'ConfigurationOfNeoCSV'; load. >>> (Smalltalk at: #ConfigurationOfNeoCSV) loadBleedingEdge. >>> >>> Any idea? >>> >>> Cheers, >>> Alexandre >>> -- >>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: >>> Alexandre Bergel http://www.bergel.eu >>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. >>> >>> >>> >> > |
The following script still raises an error… No idea why…
urlAsString := 'https://github.com/sudar/pig-samples/raw/master/data/tweets.csv'. (NeoCSVReader on: urlAsString asUrl retrieveContents readStream) skipHeader; upToEnd. Apparently SmallInteger>>codePoint does not exist... Cheers, Alexandre -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. > On May 9, 2016, at 11:49 AM, Sven Van Caekenberghe <[hidden email]> wrote: > > >> On 09 May 2016, at 16:29, Alexandre Bergel <[hidden email]> wrote: >> >> Oops… You’re right. >> Sorry about that > > No problem. > > Actually, many people use ZnEasy because it seems simple, but it can be deceiving (like in this case). > > If you want the shortest possible code in scripting I would suggest doing it like this: > > 'http://bit.ly/exampleCSV' asUrl retrieveContents. > > 'http://zn.stfx.eu/zn/numbers.txt' asUrl retrieveContents. > > The #retrieveContents message will fail unless there is a proper HTTP 200 OK response. And it is all cool unary messages ! > >> Alexandre >> -- >> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: >> Alexandre Bergel http://www.bergel.eu >> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. >> >> >> >>> On May 9, 2016, at 10:28 AM, Sven Van Caekenberghe <[hidden email]> wrote: >>> >>> >>>> On 09 May 2016, at 15:26, Alexandre Bergel <[hidden email]> wrote: >>>> >>>> Hi Sven, >>>> >>>> There is apparently a problem in NeoCSVReader. #codepoint is apparently missing >>>> The following code raises an exception: >>>> >>>> urlAsString := 'http://bit.ly/exampleCSV'. >>> >>> Can you give me a working URL so that I can try myself ? >>> >>>> content := (ZnEasy get: urlAsString) contents readStream. >>>> lines := (NeoCSVReader on: content) >>>> skipHeader; >>>> upToEnd. >>>> >>>> >>>> I loaded NeoCSV using: >>>> Gofer new >>>> smalltalkhubUser: 'SvenVanCaekenberghe' project: 'Neo'; >>>> package: 'ConfigurationOfNeoCSV'; load. >>>> (Smalltalk at: #ConfigurationOfNeoCSV) loadBleedingEdge. >>>> >>>> Any idea? >>>> >>>> Cheers, >>>> Alexandre >>>> -- >>>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: >>>> Alexandre Bergel http://www.bergel.eu >>>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. >>>> >>>> >>>> >>> >> > |
On Mon, May 09, 2016 at 03:06:38PM -0300, Alexandre Bergel wrote:
> The following script still raises an error… No idea why… > > > urlAsString := 'https://github.com/sudar/pig-samples/raw/master/data/tweets.csv'. > (NeoCSVReader on: urlAsString asUrl retrieveContents readStream) > skipHeader; > upToEnd. > > Apparently SmallInteger>>codePoint does not exist... I think you need to convert the contents to a string first... | urlAsString contents | urlAsString := 'https://github.com/sudar/pig-samples/raw/master/data/tweets.csv'. contents := urlAsString asUrl retrieveContents asString. (NeoCSVReader on: contents readStream) skipHeader; upToEnd. Cheers, Alistair |
In reply to this post by abergel
The URL you gave returns binary data, not text (which is wrong, CSV is a text based format).
Anyway, a quick fix is to use #asString (NeoCSVReader on: 'https://github.com/sudar/pig-samples/raw/master/data/tweets.csv' asUrl retrieveContents asString readStream) skipHeader; upToEnd. But that is really a hack, because we cannot know what encoding is being used (the tweets could contain anything). You could also try to use #utf8Decoded instead of #asString > On 09 May 2016, at 20:06, Alexandre Bergel <[hidden email]> wrote: > > The following script still raises an error… No idea why… > > > urlAsString := 'https://github.com/sudar/pig-samples/raw/master/data/tweets.csv'. > (NeoCSVReader on: urlAsString asUrl retrieveContents readStream) > skipHeader; > upToEnd. > > Apparently SmallInteger>>codePoint does not exist... > > Cheers, > Alexandre > -- > _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: > Alexandre Bergel http://www.bergel.eu > ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. > > > >> On May 9, 2016, at 11:49 AM, Sven Van Caekenberghe <[hidden email]> wrote: >> >> >>> On 09 May 2016, at 16:29, Alexandre Bergel <[hidden email]> wrote: >>> >>> Oops… You’re right. >>> Sorry about that >> >> No problem. >> >> Actually, many people use ZnEasy because it seems simple, but it can be deceiving (like in this case). >> >> If you want the shortest possible code in scripting I would suggest doing it like this: >> >> 'http://bit.ly/exampleCSV' asUrl retrieveContents. >> >> 'http://zn.stfx.eu/zn/numbers.txt' asUrl retrieveContents. >> >> The #retrieveContents message will fail unless there is a proper HTTP 200 OK response. And it is all cool unary messages ! >> >>> Alexandre >>> -- >>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: >>> Alexandre Bergel http://www.bergel.eu >>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. >>> >>> >>> >>>> On May 9, 2016, at 10:28 AM, Sven Van Caekenberghe <[hidden email]> wrote: >>>> >>>> >>>>> On 09 May 2016, at 15:26, Alexandre Bergel <[hidden email]> wrote: >>>>> >>>>> Hi Sven, >>>>> >>>>> There is apparently a problem in NeoCSVReader. #codepoint is apparently missing >>>>> The following code raises an exception: >>>>> >>>>> urlAsString := 'http://bit.ly/exampleCSV'. >>>> >>>> Can you give me a working URL so that I can try myself ? >>>> >>>>> content := (ZnEasy get: urlAsString) contents readStream. >>>>> lines := (NeoCSVReader on: content) >>>>> skipHeader; >>>>> upToEnd. >>>>> >>>>> >>>>> I loaded NeoCSV using: >>>>> Gofer new >>>>> smalltalkhubUser: 'SvenVanCaekenberghe' project: 'Neo'; >>>>> package: 'ConfigurationOfNeoCSV'; load. >>>>> (Smalltalk at: #ConfigurationOfNeoCSV) loadBleedingEdge. >>>>> >>>>> Any idea? >>>>> >>>>> Cheers, >>>>> Alexandre >>>>> -- >>>>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: >>>>> Alexandre Bergel http://www.bergel.eu >>>>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. >>>>> >>>>> >>>>> >>>> >>> >> > |
In reply to this post by abergel
Sounds like mime-type returned by server is application/octet-stream, so response is a bytearray, not a string.
Which means you pretty much has to cross your fingers and hope it's pure ascii, or consult an API document somewhere to find what encoding the data is actually in. Luckily, in the sample case, it looks like it might be utf8 - url := 'https://github.com/sudar/pig-samples/raw/master/data/tweets.csv'. string := ZnCharacterEncoder utf8 decodeBytes: urlAsString asUrl retrieveContents. will usually raise an error if it's not ;) (and it doesn't) Cheers, Henry > On 09 May 2016, at 8:06 , Alexandre Bergel <[hidden email]> wrote: > > The following script still raises an error… No idea why… > > > urlAsString := 'https://github.com/sudar/pig-samples/raw/master/data/tweets.csv'. > (NeoCSVReader on: readStream) > skipHeader; > upToEnd. > > Apparently SmallInteger>>codePoint does not exist... > > Cheers, > Alexandre > -- > _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: > Alexandre Bergel http://www.bergel.eu > ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. > > > >> On May 9, 2016, at 11:49 AM, Sven Van Caekenberghe <[hidden email]> wrote: >> >> >>> On 09 May 2016, at 16:29, Alexandre Bergel <[hidden email]> wrote: >>> >>> Oops… You’re right. >>> Sorry about that >> >> No problem. >> >> Actually, many people use ZnEasy because it seems simple, but it can be deceiving (like in this case). >> >> If you want the shortest possible code in scripting I would suggest doing it like this: >> >> 'http://bit.ly/exampleCSV' asUrl retrieveContents. >> >> 'http://zn.stfx.eu/zn/numbers.txt' asUrl retrieveContents. >> >> The #retrieveContents message will fail unless there is a proper HTTP 200 OK response. And it is all cool unary messages ! >> >>> Alexandre >>> -- >>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: >>> Alexandre Bergel http://www.bergel.eu >>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. >>> >>> >>> >>>> On May 9, 2016, at 10:28 AM, Sven Van Caekenberghe <[hidden email]> wrote: >>>> >>>> >>>>> On 09 May 2016, at 15:26, Alexandre Bergel <[hidden email]> wrote: >>>>> >>>>> Hi Sven, >>>>> >>>>> There is apparently a problem in NeoCSVReader. #codepoint is apparently missing >>>>> The following code raises an exception: >>>>> >>>>> urlAsString := 'http://bit.ly/exampleCSV'. >>>> >>>> Can you give me a working URL so that I can try myself ? >>>> >>>>> content := (ZnEasy get: urlAsString) contents readStream. >>>>> lines := (NeoCSVReader on: content) >>>>> skipHeader; >>>>> upToEnd. >>>>> >>>>> >>>>> I loaded NeoCSV using: >>>>> Gofer new >>>>> smalltalkhubUser: 'SvenVanCaekenberghe' project: 'Neo'; >>>>> package: 'ConfigurationOfNeoCSV'; load. >>>>> (Smalltalk at: #ConfigurationOfNeoCSV) loadBleedingEdge. >>>>> >>>>> Any idea? >>>>> >>>>> Cheers, >>>>> Alexandre >>>>> -- >>>>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: >>>>> Alexandre Bergel http://www.bergel.eu >>>>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. >>>>> >>>>> >>>>> >>>> >>> >> > > signature.asc (859 bytes) Download Attachment |
In reply to this post by alistairgrant
Wow!!!
thanks!! Not easy to guess! Alexandre
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
|
In reply to this post by Sven Van Caekenberghe-2
Thanks anyway!
Cheers, Alexandre
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
|
Free forum by Nabble | Edit this page |