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 <[email protected]> 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 <[email protected]> wrote:
>> 
>> 
>>> On 09 May 2016, at 16:29, Alexandre Bergel <[email protected]> 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 <[email protected]> wrote:
>>>> 
>>>> 
>>>>> On 09 May 2016, at 15:26, Alexandre Bergel <[email protected]> 
>>>>> 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
>>>>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>>>>> 
>>>>> 
>>>>> 
>>>> 
>>> 
>> 
> 


Reply via email to