Hello, I've trying to play around with Roassal so I load a csv.|csv mbfs cont| mbfs := FileStream fileNamed: 'C:\Users\kusr\Documents\vis\test1utf8_cut2.csv'. mbfs lineEndConvention: #crlf; converter: UTF8TextConverter new. cont := mbfs contents. Array(Object)>>primitiveFailed: Array(Object)>>primitiveFailed Array>>elementsForwardIdentityTo: ByteString(Object)>>becomeForward: ByteString>>at:put: MultiByteFileStream>>next: MultiByteFileStream(FileStream)>>contents UndefinedObject>>DoIt OpalCompiler>>evaluate RubSmalltalkEditor>>evaluate:andDo: RubSmalltalkEditor>>highlightEvaluateAndDo: [ textMorph textArea editor highlightEvaluateAndDo: ann action. textMorph shoutStyler style: textMorph text ] in [ textMorph textArea handleEdit: [ textMorph textArea editor highlightEvaluateAndDo: ann action. textMorph shoutStyler style: textMorph text ] ] in GLMMorphicPharoScriptRenderer(GLMMorphicPharoCodeRenderer)>>actOnHighlightAndEvaluate: in Block: [ textMorph textArea editor highlightEvaluateAndDo...etc... RubEditingArea(RubAbstractTextArea)>>handleEdit: [ textMorph textArea handleEdit: [ textMorph textArea editor highlightEvaluateAndDo: ann action. textMorph shoutStyler style: textMorph text ] ] in GLMMorphicPharoScriptRenderer(GLMMorphicPharoCodeRenderer)>>actOnHighlightAndEvaluate: in Block: [ textMorph textArea... WorldState>>runStepMethodsIn: WorldMorph>>runStepMethods WorldState>>doOneCycleNowFor: WorldState>>doOneCycleFor: WorldState>>doOneSubCycleFor: WorldMorph>>doOneSubCycle MenuMorph>>invokeModalAt:in:allowKeyboard: MenuMorph>>invokeModal: MenuMorph>>invokeModal [ :menu | menu setInvokingView: self editor. menu invokeModal. self changed. ^ true ] in RubEditingArea(RubAbstractTextArea)>>yellowButtonActivity: in Block: [ :menu | ... MenuMorph(Object)>>ifNotNilDo: RubEditingArea(RubAbstractTextArea)>>yellowButtonActivity: RubEditingArea(RubAbstractTextArea)>>mouseDown: RubEditingArea(Morph)>>handleMouseDown: MouseButtonEvent>>sentTo: RubEditingArea(Morph)>>handleEvent: ... aCharacter isOctetCharacter ifFalse:[ "Convert to WideString" self becomeForward: (WideString from: self). ^self at: index put: aCharacter. ... Image is moose_suite_6_0 on windows. What should I do? What is frightening that I linked file and SOMETIMES it raises the error above and sometimes not... ??? (zip file with sample csv...) thanks Robert |
Hi Robert,
You should use more modern stuff ;-) This works for me (Pharo 4, macOS), using your file: ((FileLocator desktop / 'test1utf8_cut2.csv') readStreamDo: [ :in | (NeoCSVReader on: in) separator: $; ; upToEnd ]) first: 4. ==>> #( #('rend.szam' 'cikkszam' 'cikk.megnev' 'dop_id' 'dop.cikszam' 'dop.megnev' 'termekgazda' 'kesz.menny' 'igeny.menny' 'muvelet.sz' '2' 'munkahely' 'muv.start' 'muv.befejez' 'naptar' 'munkanap' 'mnap.start' 'mnap.befejez' 'TOL' 'IG' 'PERIOD' 'óra') #('100509' 'KK00160' 'Szépművészeti Múzeum Baráti kör FEHÉR' '27240' 'KK00160' 'Szépműv.Múzeum Baráti Kör FEHÉR /11900099/' 'CSOMBOKZ' '0' '4' '10' '10' 'FMKM2' '2016.10.28 21:57' '2016.10.28 21:58' 'K52' '2016.10.28 0:00' '2016.10.28 6:00' '2016.10.28 14:00' nil nil 'M1' nil) #('100509' 'KK00160' 'Szépművészeti Múzeum Baráti kör FEHÉR' '27240' 'KK00160' 'Szépműv.Múzeum Baráti Kör FEHÉR /11900099/' 'CSOMBOKZ' '0' '4' '10' '10' 'FMKM2' '2016.10.28 21:57' '2016.10.28 21:58' 'K52' '2016.10.28 0:00' '2016.10.28 14:00' '2016.10.28 22:00' '2016.10.28 21:57' '2016.10.28 21:58' 'M2' '0,01') #('100509' 'KK00160' 'Szépművészeti Múzeum Baráti kör FEHÉR' '27240' 'KK00160' 'Szépműv.Múzeum Baráti Kör FEHÉR /11900099/' 'CSOMBOKZ' '0' '4' '20' '20' 'FMKM2' '2016.10.28 21:58' '2016.10.28 22:00' 'K52' '2016.10.28 0:00' '2016.10.28 6:00' '2016.10.28 14:00' nil nil 'M1' nil) ) HTH Sven > On 14 Nov 2016, at 09:55, Robert Kuszinger <[hidden email]> wrote: > > Hello, > > I've trying to play around with Roassal so I load a csv. > > Code by far is here: > > > |csv mbfs cont| > > > mbfs := FileStream fileNamed: 'C:\Users\kusr\Documents\vis\test1utf8_cut2.csv'. > mbfs > lineEndConvention: #crlf; > converter: UTF8TextConverter new. > cont := mbfs contents. > > > In the contents message the following happens: > > Array(Object)>>primitiveFailed: > Array(Object)>>primitiveFailed > Array>>elementsForwardIdentityTo: > ByteString(Object)>>becomeForward: > ByteString>>at:put: > MultiByteFileStream>>next: > MultiByteFileStream(FileStream)>>contents > UndefinedObject>>DoIt > OpalCompiler>>evaluate > RubSmalltalkEditor>>evaluate:andDo: > RubSmalltalkEditor>>highlightEvaluateAndDo: > [ textMorph textArea editor highlightEvaluateAndDo: ann action. > textMorph shoutStyler style: textMorph text ] in [ textMorph textArea > handleEdit: [ textMorph textArea editor highlightEvaluateAndDo: ann action. > textMorph shoutStyler style: textMorph text ] ] in GLMMorphicPharoScriptRenderer(GLMMorphicPharoCodeRenderer)>>actOnHighlightAndEvaluate: in Block: [ textMorph textArea editor highlightEvaluateAndDo...etc... > RubEditingArea(RubAbstractTextArea)>>handleEdit: > [ textMorph textArea > handleEdit: [ textMorph textArea editor highlightEvaluateAndDo: ann action. > textMorph shoutStyler style: textMorph text ] ] in GLMMorphicPharoScriptRenderer(GLMMorphicPharoCodeRenderer)>>actOnHighlightAndEvaluate: in Block: [ textMorph textArea... > WorldState>>runStepMethodsIn: > WorldMorph>>runStepMethods > WorldState>>doOneCycleNowFor: > WorldState>>doOneCycleFor: > WorldState>>doOneSubCycleFor: > WorldMorph>>doOneSubCycle > MenuMorph>>invokeModalAt:in:allowKeyboard: > MenuMorph>>invokeModal: > MenuMorph>>invokeModal > [ :menu | > menu setInvokingView: self editor. > menu invokeModal. > self changed. > ^ true ] in RubEditingArea(RubAbstractTextArea)>>yellowButtonActivity: in Block: [ :menu | ... > MenuMorph(Object)>>ifNotNilDo: > RubEditingArea(RubAbstractTextArea)>>yellowButtonActivity: > RubEditingArea(RubAbstractTextArea)>>mouseDown: > RubEditingArea(Morph)>>handleMouseDown: > MouseButtonEvent>>sentTo: > RubEditingArea(Morph)>>handleEvent: > > > > HERE: (ByteString at:put:) > > ... > aCharacter isOctetCharacter ifFalse:[ > "Convert to WideString" > self becomeForward: (WideString from: self). > ^self at: index put: aCharacter. > ... > > Image is > > moose_suite_6_0 on windows. > > What should I do? What is frightening that I linked file and SOMETIMES > it raises the error above and sometimes not... ??? > > (zip file with sample csv...) > > https://drive.google.com/file/d/0B0JASZM9_9QqX19JZElwMVVXWjA/view?usp=sharing > > thanks > Robert > > > > -- Sven Van Caekenberghe Proudly supporting Pharo http://pharo.org http://association.pharo.org http://consortium.pharo.org |
In reply to this post by kuszi
And if you want to have 100% control over decoding, you can do as follows:
(FileLocator desktop / 'test1utf8_cut2.csv') binaryReadStreamDo: [ :in | (NeoCSVReader on: (ZnCharacterReadStream on: in)) separator: $; ; upToEnd ]. (FileLocator desktop / 'test1utf8_cut2.csv') binaryReadStreamDo: [ :in | (NeoCSVReader on: (ZnCharacterReadStream on: in encoding: #utf8)) separator: $; ; upToEnd ]. See also, https://ci.inria.fr/pharo-contribution/job/EnterprisePharoBook/lastSuccessfulBuild/artifact/book-result/Zinc-Encoding-Meta/Zinc-Encoding-Meta.html Part of books.pharo.org (http://files.pharo.org/books/enterprise-pharo/) > On 14 Nov 2016, at 09:55, Robert Kuszinger <[hidden email]> wrote: > > Hello, > > I've trying to play around with Roassal so I load a csv. > > Code by far is here: > > > |csv mbfs cont| > > > mbfs := FileStream fileNamed: 'C:\Users\kusr\Documents\vis\test1utf8_cut2.csv'. > mbfs > lineEndConvention: #crlf; > converter: UTF8TextConverter new. > cont := mbfs contents. > > > In the contents message the following happens: > > Array(Object)>>primitiveFailed: > Array(Object)>>primitiveFailed > Array>>elementsForwardIdentityTo: > ByteString(Object)>>becomeForward: > ByteString>>at:put: > MultiByteFileStream>>next: > MultiByteFileStream(FileStream)>>contents > UndefinedObject>>DoIt > OpalCompiler>>evaluate > RubSmalltalkEditor>>evaluate:andDo: > RubSmalltalkEditor>>highlightEvaluateAndDo: > [ textMorph textArea editor highlightEvaluateAndDo: ann action. > textMorph shoutStyler style: textMorph text ] in [ textMorph textArea > handleEdit: [ textMorph textArea editor highlightEvaluateAndDo: ann action. > textMorph shoutStyler style: textMorph text ] ] in GLMMorphicPharoScriptRenderer(GLMMorphicPharoCodeRenderer)>>actOnHighlightAndEvaluate: in Block: [ textMorph textArea editor highlightEvaluateAndDo...etc... > RubEditingArea(RubAbstractTextArea)>>handleEdit: > [ textMorph textArea > handleEdit: [ textMorph textArea editor highlightEvaluateAndDo: ann action. > textMorph shoutStyler style: textMorph text ] ] in GLMMorphicPharoScriptRenderer(GLMMorphicPharoCodeRenderer)>>actOnHighlightAndEvaluate: in Block: [ textMorph textArea... > WorldState>>runStepMethodsIn: > WorldMorph>>runStepMethods > WorldState>>doOneCycleNowFor: > WorldState>>doOneCycleFor: > WorldState>>doOneSubCycleFor: > WorldMorph>>doOneSubCycle > MenuMorph>>invokeModalAt:in:allowKeyboard: > MenuMorph>>invokeModal: > MenuMorph>>invokeModal > [ :menu | > menu setInvokingView: self editor. > menu invokeModal. > self changed. > ^ true ] in RubEditingArea(RubAbstractTextArea)>>yellowButtonActivity: in Block: [ :menu | ... > MenuMorph(Object)>>ifNotNilDo: > RubEditingArea(RubAbstractTextArea)>>yellowButtonActivity: > RubEditingArea(RubAbstractTextArea)>>mouseDown: > RubEditingArea(Morph)>>handleMouseDown: > MouseButtonEvent>>sentTo: > RubEditingArea(Morph)>>handleEvent: > > > > HERE: (ByteString at:put:) > > ... > aCharacter isOctetCharacter ifFalse:[ > "Convert to WideString" > self becomeForward: (WideString from: self). > ^self at: index put: aCharacter. > ... > > Image is > > moose_suite_6_0 on windows. > > What should I do? What is frightening that I linked file and SOMETIMES > it raises the error above and sometimes not... ??? > > (zip file with sample csv...) > > https://drive.google.com/file/d/0B0JASZM9_9QqX19JZElwMVVXWjA/view?usp=sharing > > thanks > Robert > > > > |
In reply to this post by Sven Van Caekenberghe-2
Sven, thanks for the fast reply. It worked for sure, but only in a fresh Pharo 5 donwload, NeoCSV load and so on.2016-11-14 10:05 GMT+01:00 Sven Van Caekenberghe <[hidden email]>: Hi Robert, |
Hi,
You could not load NeoCSV in a Moose 6.0 image? What was the error? Cheers, Doru > On Nov 14, 2016, at 11:26 AM, Robert Kuszinger <[hidden email]> wrote: > > Sven, > > thanks for the fast reply. It worked for sure, but only in a fresh Pharo 5 donwload, NeoCSV load and so on. > It failed in Moose 6 windows one click distribution so it may signal a Moose 6 image/config/class problem or incompatibility. > > Your recommendation is more elegant so I walk this way :) > > thanks > Robert > > > 2016-11-14 10:05 GMT+01:00 Sven Van Caekenberghe <[hidden email]>: > Hi Robert, > > You should use more modern stuff ;-) > > This works for me (Pharo 4, macOS), using your file: > > ((FileLocator desktop / 'test1utf8_cut2.csv') readStreamDo: [ :in | > (NeoCSVReader on: in) separator: $; ; upToEnd ]) first: 4. > > ==>> > > #( > #('rend.szam' 'cikkszam' 'cikk.megnev' 'dop_id' 'dop.cikszam' 'dop.megnev' 'termekgazda' 'kesz.menny' 'igeny.menny' 'muvelet.sz' '2' 'munkahely' 'muv.start' 'muv.befejez' 'naptar' 'munkanap' 'mnap.start' 'mnap.befejez' 'TOL' 'IG' 'PERIOD' 'óra') > #('100509' 'KK00160' 'Szépművészeti Múzeum Baráti kör FEHÉR' '27240' 'KK00160' 'Szépműv.Múzeum Baráti Kör FEHÉR /11900099/' 'CSOMBOKZ' '0' '4' '10' '10' 'FMKM2' '2016.10.28 21:57' '2016.10.28 21:58' 'K52' '2016.10.28 0:00' '2016.10.28 6:00' '2016.10.28 14:00' nil nil 'M1' nil) > #('100509' 'KK00160' 'Szépművészeti Múzeum Baráti kör FEHÉR' '27240' 'KK00160' 'Szépműv.Múzeum Baráti Kör FEHÉR /11900099/' 'CSOMBOKZ' '0' '4' '10' '10' 'FMKM2' '2016.10.28 21:57' '2016.10.28 21:58' 'K52' '2016.10.28 0:00' '2016.10.28 14:00' '2016.10.28 22:00' '2016.10.28 21:57' '2016.10.28 21:58' 'M2' '0,01') > #('100509' 'KK00160' 'Szépművészeti Múzeum Baráti kör FEHÉR' '27240' 'KK00160' 'Szépműv.Múzeum Baráti Kör FEHÉR /11900099/' 'CSOMBOKZ' '0' '4' '20' '20' 'FMKM2' '2016.10.28 21:58' '2016.10.28 22:00' 'K52' '2016.10.28 0:00' '2016.10.28 6:00' '2016.10.28 14:00' nil nil 'M1' nil) > ) > > HTH > > Sven > > > On 14 Nov 2016, at 09:55, Robert Kuszinger <[hidden email]> wrote: > > > > Hello, > > > > I've trying to play around with Roassal so I load a csv. > > > > Code by far is here: > > > > > > |csv mbfs cont| > > > > > > mbfs := FileStream fileNamed: 'C:\Users\kusr\Documents\vis\test1utf8_cut2.csv'. > > mbfs > > lineEndConvention: #crlf; > > converter: UTF8TextConverter new. > > cont := mbfs contents. > > > > > > In the contents message the following happens: > > > > Array(Object)>>primitiveFailed: > > Array(Object)>>primitiveFailed > > Array>>elementsForwardIdentityTo: > > ByteString(Object)>>becomeForward: > > ByteString>>at:put: > > MultiByteFileStream>>next: > > MultiByteFileStream(FileStream)>>contents > > UndefinedObject>>DoIt > > OpalCompiler>>evaluate > > RubSmalltalkEditor>>evaluate:andDo: > > RubSmalltalkEditor>>highlightEvaluateAndDo: > > [ textMorph textArea editor highlightEvaluateAndDo: ann action. > > textMorph shoutStyler style: textMorph text ] in [ textMorph textArea > > handleEdit: [ textMorph textArea editor highlightEvaluateAndDo: ann action. > > textMorph shoutStyler style: textMorph text ] ] in GLMMorphicPharoScriptRenderer(GLMMorphicPharoCodeRenderer)>>actOnHighlightAndEvaluate: in Block: [ textMorph textArea editor highlightEvaluateAndDo...etc... > > RubEditingArea(RubAbstractTextArea)>>handleEdit: > > [ textMorph textArea > > handleEdit: [ textMorph textArea editor highlightEvaluateAndDo: ann action. > > textMorph shoutStyler style: textMorph text ] ] in GLMMorphicPharoScriptRenderer(GLMMorphicPharoCodeRenderer)>>actOnHighlightAndEvaluate: in Block: [ textMorph textArea... > > WorldState>>runStepMethodsIn: > > WorldMorph>>runStepMethods > > WorldState>>doOneCycleNowFor: > > WorldState>>doOneCycleFor: > > WorldState>>doOneSubCycleFor: > > WorldMorph>>doOneSubCycle > > MenuMorph>>invokeModalAt:in:allowKeyboard: > > MenuMorph>>invokeModal: > > MenuMorph>>invokeModal > > [ :menu | > > menu setInvokingView: self editor. > > menu invokeModal. > > self changed. > > ^ true ] in RubEditingArea(RubAbstractTextArea)>>yellowButtonActivity: in Block: [ :menu | ... > > MenuMorph(Object)>>ifNotNilDo: > > RubEditingArea(RubAbstractTextArea)>>yellowButtonActivity: > > RubEditingArea(RubAbstractTextArea)>>mouseDown: > > RubEditingArea(Morph)>>handleMouseDown: > > MouseButtonEvent>>sentTo: > > RubEditingArea(Morph)>>handleEvent: > > > > > > > > HERE: (ByteString at:put:) > > > > ... > > aCharacter isOctetCharacter ifFalse:[ > > "Convert to WideString" > > self becomeForward: (WideString from: self). > > ^self at: index put: aCharacter. > > ... > > > > Image is > > > > moose_suite_6_0 on windows. > > > > What should I do? What is frightening that I linked file and SOMETIMES > > it raises the error above and sometimes not... ??? > > > > (zip file with sample csv...) > > > > https://drive.google.com/file/d/0B0JASZM9_9QqX19JZElwMVVXWjA/view?usp=sharing > > > > thanks > > Robert > > > > > > > > > > > > -- > Sven Van Caekenberghe > Proudly supporting Pharo > http://pharo.org > http://association.pharo.org > http://consortium.pharo.org > > > > > > -- www.tudorgirba.com www.feenk.com "We cannot reach the flow of things unless we let go." |
Hello! Steps:
Error as follows. The same happened with the alternative code from Sven. This is a 64bit Windows 7. Should I do any more test for you? regards Robert > > |
Free forum by Nabble | Edit this page |