From spruit_frank at hotmail.com Wed Feb 6 09:30:38 2008 From: spruit_frank at hotmail.com (frankje) Date: Wed, 6 Feb 2008 00:30:38 -0800 (PST) Subject: [python-nl] module is not working Message-ID: <15306303.post@talk.nabble.com> Hello, I created the following module keer.py: def times (x,y): return x*y Now, when I am in IDLE at the prompt, and type: import keer And then for example: times (4,5) I get the following message: >>> times (4,5) Traceback (most recent call last): File "", line 1, in times (4,5) NameError: name 'times' is not defined >>> What am I doing wrong? grtz, Frank -- View this message in context: http://www.nabble.com/module-is-not-working-tp15306303p15306303.html Sent from the Python - python-nl mailing list archive at Nabble.com. From asmodai at in-nomine.org Wed Feb 6 09:34:59 2008 From: asmodai at in-nomine.org (Jeroen Ruigrok van der Werven) Date: Wed, 6 Feb 2008 09:34:59 +0100 Subject: [python-nl] module is not working In-Reply-To: <15306303.post@talk.nabble.com> References: <15306303.post@talk.nabble.com> Message-ID: <20080206083459.GA39133@nexus.in-nomine.org> -On [20080206 09:31], frankje (spruit_frank at hotmail.com) wrote: > >keer.py: > >def times (x,y): >return x*y > >Now, when I am in IDLE at the prompt, and type: import keer >And then for example: times (4,5) from keer import times times(4, 5) or import keer keer.times(4, 5) -- Jeroen Ruigrok van der Werven / asmodai ????? ?????? ??? ?? ?????? http://www.in-nomine.org/ | http://www.rangaku.org/ We have met the enemy and they are ours... From connorsml at gmail.com Wed Feb 6 09:37:22 2008 From: connorsml at gmail.com (Michael Connors) Date: Wed, 6 Feb 2008 09:37:22 +0100 Subject: [python-nl] module is not working In-Reply-To: <15306303.post@talk.nabble.com> References: <15306303.post@talk.nabble.com> Message-ID: If you are doing: import keer , try: keer.times(4, 5) Instead If you do: from keer import times you cal use: times(4, 5) On 06/02/2008, frankje wrote: > > > Hello, > > I created the following module keer.py: > > def times (x,y): > return x*y > > Now, when I am in IDLE at the prompt, and type: import keer > And then for example: times (4,5) > > I get the following message: > > >>> times (4,5) > Traceback (most recent call last): > File "", line 1, in > times (4,5) > NameError: name 'times' is not defined > >>> > > What am I doing wrong? > > > grtz, Frank > > > -- > View this message in context: > http://www.nabble.com/module-is-not-working-tp15306303p15306303.html > Sent from the Python - python-nl mailing list archive at Nabble.com. > > _______________________________________________ > Python-nl mailing list > Python-nl at python.org > http://mail.python.org/mailman/listinfo/python-nl > -- Michael Connors -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-nl/attachments/20080206/05fe1941/attachment.htm From armijn at uulug.nl Wed Feb 6 09:35:49 2008 From: armijn at uulug.nl (Armijn Hemel) Date: Wed, 06 Feb 2008 09:35:49 +0100 Subject: [python-nl] module is not working In-Reply-To: <15306303.post@talk.nabble.com> References: <15306303.post@talk.nabble.com> Message-ID: <1202286949.2731.2.camel@kroepoek.local> On Wed, 2008-02-06 at 00:30 -0800, frankje wrote: > Hello, > > I created the following module keer.py: > > def times (x,y): > return x*y > > Now, when I am in IDLE at the prompt, and type: import keer > And then for example: times (4,5) > > I get the following message: > > >>> times (4,5) > Traceback (most recent call last): > File "", line 1, in > times (4,5) > NameError: name 'times' is not defined > >>> > > What am I doing wrong? Either write: from keer import times or keer.times(4,5) armijn -- --------------------------------------------------------------------------- armijn at uulug.nl | http://www.uulug.nl/ | UULug: Utrecht Linux Users Group --------------------------------------------------------------------------- From spruit_frank at hotmail.com Wed Feb 6 11:20:00 2008 From: spruit_frank at hotmail.com (frankje) Date: Wed, 6 Feb 2008 02:20:00 -0800 (PST) Subject: [python-nl] module is not working In-Reply-To: <15306303.post@talk.nabble.com> References: <15306303.post@talk.nabble.com> Message-ID: <15306424.post@talk.nabble.com> Bedankt voor de mailtjes, ik kom er nu wel uit (keer.times). grtn, Frank ps. Sorry voor het engels, ik was even in de war met een soortgelijk engelstalig forum... -- View this message in context: http://www.nabble.com/module-is-not-working-tp15306303p15306424.html Sent from the Python - python-nl mailing list archive at Nabble.com. From wichert at wiggy.net Wed Feb 6 10:41:58 2008 From: wichert at wiggy.net (Wichert Akkerman) Date: Wed, 06 Feb 2008 10:41:58 +0100 Subject: [python-nl] module is not working In-Reply-To: <15306303.post@talk.nabble.com> References: <15306303.post@talk.nabble.com> Message-ID: <47A980E6.5070102@wiggy.net> frankje wrote: > What am I doing wrong? > Nitpick: Engels praten op de Nederlandse python lijst :) Wichert. -- Wichert Akkerman It is simple to make things. http://www.wiggy.net/ It is hard to make things simple. From egbert.bouwman at hccnet.nl Thu Feb 7 19:45:00 2008 From: egbert.bouwman at hccnet.nl (egbert) Date: Thu, 7 Feb 2008 19:45:00 +0100 Subject: [python-nl] print euro Message-ID: <20080207184500.GA6586@hccnet.nl> Hallo, Ik probeer unicode te begrijpen, en dat valt niet mee. De python versie is 2.4.4 Mijn default encoding is utf-8, sys.getdefaultencoding() speelt dat terug in IDLE en de python shells python, iPython. In IDLE gaat alles goed: print unichr(164) ---> een soort zonnetje print unichr(8364) ---> het euro teken maar in de python shells: print unichr(164) ---> het euro teken, en dat is latin-9 print unichr(8364) ---> gaat fout, not in range(256) Zelf heb ik nergens latin-9 (iso-8859-15) opgegeven. Kan iemand me uitleggen wat er aan de hand is ? Hoe moet ik in een script nu een euro-teken laten printen ? Met dank voor het denkwerk. e - Egbert Bouwman - Keizersgracht 197 II - 1016 DS Amsterdam - 020 6257991 ======================================================================== From asmodai at in-nomine.org Thu Feb 7 20:37:58 2008 From: asmodai at in-nomine.org (Jeroen Ruigrok van der Werven) Date: Thu, 7 Feb 2008 20:37:58 +0100 Subject: [python-nl] print euro In-Reply-To: <20080207184500.GA6586@hccnet.nl> References: <20080207184500.GA6586@hccnet.nl> Message-ID: <20080207193758.GH39133@nexus.in-nomine.org> -On [20080207 20:20], egbert (egbert.bouwman at hccnet.nl) wrote: >maar in de python shells: > print unichr(164) ---> het euro teken, en dat is latin-9 > print unichr(8364) ---> gaat fout, not in range(256) Op mijn FreeBSD machine met locale op UTF-8 werkt je voorbeeld gewoon: >>> print unichr(8364) ? Ik denk dat je hier tegenaan loopt: http://bugs.python.org/issue1602 Normaal gesproken zou je codepage 65001 op Windows gebruiken voor UTF-8 ondersteuning. -- Jeroen Ruigrok van der Werven / asmodai ????? ?????? ??? ?? ?????? http://www.in-nomine.org/ | http://www.rangaku.org/ To err is human, to forgive divine... From egbert.bouwman at hccnet.nl Thu Feb 7 23:41:07 2008 From: egbert.bouwman at hccnet.nl (egbert) Date: Thu, 7 Feb 2008 23:41:07 +0100 Subject: [python-nl] print euro In-Reply-To: <20080207193758.GH39133@nexus.in-nomine.org> References: <20080207184500.GA6586@hccnet.nl> <20080207193758.GH39133@nexus.in-nomine.org> Message-ID: <20080207224107.GA14081@hccnet.nl> On Thu, Feb 07, 2008 at 08:37:58PM +0100, Jeroen Ruigrok van der Werven wrote: > Op mijn FreeBSD machine met locale op UTF-8 werkt je voorbeeld gewoon: > > >>> print unichr(8364) > ??? > Jouw antwoord las ik eerst met mutt, op een normale linux console, niks grafisch dus. Je laatste regel hierboven verschijnt als drie vraagtekens. ??? Ik heb het bericht doorgestuurd naar Evolution (X Window), en daar verschijnt het euro teken ipv ???. Het lijkt allemaal meer aan de omgeving te liggen waarbinnen een programma draait dan aan het programma zelf. Een intelligenter opmerking kan ik nog niet maken. e -- Egbert Bouwman - Keizersgracht 197 II - 1016 DS Amsterdam - 020 6257991 ======================================================================== From armijn at uulug.nl Thu Feb 7 23:49:28 2008 From: armijn at uulug.nl (Armijn Hemel) Date: Thu, 07 Feb 2008 23:49:28 +0100 Subject: [python-nl] print euro In-Reply-To: <20080207224107.GA14081@hccnet.nl> References: <20080207184500.GA6586@hccnet.nl> <20080207193758.GH39133@nexus.in-nomine.org> <20080207224107.GA14081@hccnet.nl> Message-ID: <1202424569.7399.5.camel@kroepoek.local> On Thu, 2008-02-07 at 23:41 +0100, egbert wrote: > > Het lijkt allemaal meer aan de omgeving te liggen waarbinnen > een programma draait dan aan het programma zelf. > Een intelligenter opmerking kan ik nog niet maken. Wat zegt iets als "echo $LANG" in je terminal? armijn -- --------------------------------------------------------------------------- armijn at uulug.nl | http://www.uulug.nl/ | UULug: Utrecht Linux Users Group --------------------------------------------------------------------------- From asmodai at in-nomine.org Fri Feb 8 07:26:02 2008 From: asmodai at in-nomine.org (Jeroen Ruigrok van der Werven) Date: Fri, 8 Feb 2008 07:26:02 +0100 Subject: [python-nl] print euro In-Reply-To: <20080207224107.GA14081@hccnet.nl> References: <20080207184500.GA6586@hccnet.nl> <20080207193758.GH39133@nexus.in-nomine.org> <20080207224107.GA14081@hccnet.nl> Message-ID: <20080208062602.GJ39133@nexus.in-nomine.org> -On [20080207 23:41], egbert (egbert.bouwman at hccnet.nl) wrote: >Jouw antwoord las ik eerst met mutt, op een normale linux console, >niks grafisch dus. Je laatste regel hierboven verschijnt >als drie vraagtekens. ??? Ik heb het verstuurd via mutt op een FreeBSD machine middels een PuTTY sessie. >Ik heb het bericht doorgestuurd naar Evolution (X Window), >en daar verschijnt het euro teken ipv ???. > >Het lijkt allemaal meer aan de omgeving te liggen waarbinnen >een programma draait dan aan het programma zelf. >Een intelligenter opmerking kan ik nog niet maken. Kijk wat 'locale' je als waardes teruggeeft. En dan moet je nog eens fonts gebruiken die de karakters ondersteunen anders ga je alsnog replacement glyphs zien. Maar je had het ook over IPython welke ik aannam als Iron Python en dat was toch wel op Windows? Zo ja, dan is het hele locale verhaal toch anders. -- Jeroen Ruigrok van der Werven / asmodai ????? ?????? ??? ?? ?????? http://www.in-nomine.org/ | http://www.rangaku.org/ Hajimari dake yume mite okiru sono saki nara itsuka jibun no ude de... From egbert.bouwman at hccnet.nl Fri Feb 8 11:00:55 2008 From: egbert.bouwman at hccnet.nl (egbert) Date: Fri, 8 Feb 2008 11:00:55 +0100 Subject: [python-nl] print euro In-Reply-To: <20080208062602.GJ39133@nexus.in-nomine.org> References: <20080207184500.GA6586@hccnet.nl> <20080207193758.GH39133@nexus.in-nomine.org> <20080207224107.GA14081@hccnet.nl> <20080208062602.GJ39133@nexus.in-nomine.org> Message-ID: <20080208100055.GA4938@hccnet.nl> On Fri, Feb 08, 2008 at 07:26:02AM +0100, Jeroen Ruigrok van der Werven wrote: > Kijk wat 'locale' je als waardes teruggeeft. > locale geeft overal 'en_US' behalve LANGUAGE=en_NL:en_US:en_GB:en > En dan moet je nog eens fonts gebruiken die de karakters > ondersteunen anders ga je alsnog replacement glyphs zien. De linux console is een text terminal, en daarin kan je weinig aan de fonts doen, dacht ik. > Maar je had het ook over IPython welke ik aannam als Iron Python en dat was > toch wel op Windows? Zo ja, dan is het hele locale verhaal toch anders. iPython is een betere python shell, zie ipython.scipy.org Windows gebruik ik alleen als mijn echtgenote hulp nodig heeft, en dat gebeurt gelukkig steeds minder. De kern van mijn probleem verwatert een beetje: hoe ziet het python script er uit dat een euro teken produceert als je niet van te voren weet waar de uitvoer naar toe gaat, een text console, een grafische console of een bestand. egbert -- Egbert Bouwman - Keizersgracht 197 II - 1016 DS Amsterdam - 020 6257991 ======================================================================== From eric at infrae.com Fri Feb 8 11:09:57 2008 From: eric at infrae.com (eric casteleijn) Date: Fri, 08 Feb 2008 11:09:57 +0100 Subject: [python-nl] print euro In-Reply-To: <20080208100055.GA4938@hccnet.nl> References: <20080207184500.GA6586@hccnet.nl> <20080207193758.GH39133@nexus.in-nomine.org> <20080207224107.GA14081@hccnet.nl> <20080208062602.GJ39133@nexus.in-nomine.org> <20080208100055.GA4938@hccnet.nl> Message-ID: <47AC2A75.4000200@infrae.com> > De kern van mijn probleem verwatert een beetje: > hoe ziet het python script er uit dat een euro teken produceert > als je niet van te voren weet waar de uitvoer naar toe gaat, > een text console, een grafische console of een bestand. > egbert In principe: In python gebruik je *altijd* unicode strings, en nooit encodings. Als er text de applicatie binnenkomt, decodeer je die onmiddelijk (als het goed is weet je in welke encoding de tekst binnenkomt) en pas op het allerlaatst mogelijke moment voordat je tekst naar een display, of iets anders stuurt dat een encoding vereist, encodeer je weer, en dan naar de encoding die die display nodig heeft. Dus, in je python script doe je gewoon: euro = u'?' en als je ooit naar iets moet printen wat een encoding verwacht, dan doe je bijvoorbeeld: print euro.encode('utf-8') Dit is de enige manier om te voorkomen dat je enorme hoofdpijn bugs krijgt met dubbele en-/decodings. -- - eric casteleijn http://infrae.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 252 bytes Desc: OpenPGP digital signature Url : http://mail.python.org/pipermail/python-nl/attachments/20080208/0547cdfa/attachment.pgp From klaas at vanschelven.com Fri Feb 8 11:52:24 2008 From: klaas at vanschelven.com (Klaas van Schelven) Date: Fri, 8 Feb 2008 12:52:24 +0200 Subject: [python-nl] print euro In-Reply-To: <20080208100055.GA4938@hccnet.nl> References: <20080207184500.GA6586@hccnet.nl> <20080207193758.GH39133@nexus.in-nomine.org> <20080207224107.GA14081@hccnet.nl> <20080208062602.GJ39133@nexus.in-nomine.org> <20080208100055.GA4938@hccnet.nl> Message-ID: <1048eec20802080252m579ef42bhb315d9c2bb5fc9f6@mail.gmail.com> Egbert, Je vraag "een euroteken te produceren onafhankelijk van waar de uitvoer naar toe gaat" is in zekere zin niet te beantwoorden binnen de context van je python-code alleen. Er bestaat namelijk niet zoiets als een "plain text" bestand - een tekstbestand is altijd opgeslagen in een encoding (die je dus in de context van dat bestand moet kennen). Iets soortgelijks geld voor consoles: als zij niet ondersteuenen wat jij probeert af te drukken gaat het niet werken om dat af te drukken. Als je dus iets "totaal portables" wil hebben zal je ook zorg moeten dragen voor de omgeving waarin je code wordt uitgevoerd... ik weet niet hoever je ambities gaan voor deze code en portabiliteit, maar da's een hoop werk. groet, Klaas -- Klaas van Schelven http://www.pythonexpert.nl Het Platform voor Python Werk De kern van mijn probleem verwatert een beetje: > hoe ziet het python script er uit dat een euro teken produceert > als je niet van te voren weet waar de uitvoer naar toe gaat, > een text console, een grafische console of een bestand. > egbert > -- > Egbert Bouwman - Keizersgracht 197 II - 1016 DS Amsterdam - 020 6257991 > ======================================================================== > _______________________________________________ > Python-nl mailing list > Python-nl op python.org > http://mail.python.org/mailman/listinfo/python-nl > ------------- volgend deel ------------ Een HTML-bijlage is verwijderd... URL: http://mail.python.org/pipermail/python-nl/attachments/20080208/b1b82066/attachment.htm From remco at gerlich.nl Fri Feb 8 12:32:06 2008 From: remco at gerlich.nl (Remco Gerlich) Date: Fri, 8 Feb 2008 12:32:06 +0100 Subject: [python-nl] print euro In-Reply-To: <20080208100055.GA4938@hccnet.nl> References: <20080207184500.GA6586@hccnet.nl> <20080207193758.GH39133@nexus.in-nomine.org> <20080207224107.GA14081@hccnet.nl> <20080208062602.GJ39133@nexus.in-nomine.org> <20080208100055.GA4938@hccnet.nl> Message-ID: <7ae3ca10802080332n1e70df6yf93bb889ef50132f@mail.gmail.com> 2008/2/8 egbert : > De kern van mijn probleem verwatert een beetje: > hoe ziet het python script er uit dat een euro teken produceert > als je niet van te voren weet waar de uitvoer naar toe gaat, > een text console, een grafische console of een bestand. > Dit is wel een goed moment om deze link eens te geven: http://www.joelonsoftware.com/articles/Unicode.html Er is een verschil tussen "Unicode code points", en specifieke encodings. In principe _is_ unichr(8364) een Unicode euroteken. Maar er zijn tig manieren om dat te vertalen naar een of meer bytes; en om het uiteindelijk goed op het scherm te krijgen, moet het programma dat die bytes laat zien dezelfde methode gebruiken. Als je bijvoorbeeld UTF-8 kiest, dan moet je terminal, grafische console of programma dat dat bestand weergeeft, ook weten dat het UTF-8 is, dat aankunnen, en een font gebruiken dat een euroteken bevat. Remco ------------- volgend deel ------------ Een HTML-bijlage is verwijderd... URL: http://mail.python.org/pipermail/python-nl/attachments/20080208/8e7357aa/attachment.htm From spruit_frank at hotmail.com Sun Feb 10 00:58:18 2008 From: spruit_frank at hotmail.com (frankje) Date: Sat, 9 Feb 2008 15:58:18 -0800 (PST) Subject: [python-nl] tkinter Message-ID: <15391706.post@talk.nabble.com> Hallo, Ik gebruik linux ubuntu 7.10 en nou is mijn vraag hoe ik tkinter kan opstarten... grtn, Frank -- View this message in context: http://www.nabble.com/tkinter-tp15391706p15391706.html Sent from the Python - python-nl mailing list archive at Nabble.com. From ward.ubuntu at gmail.com Sun Feb 10 02:35:56 2008 From: ward.ubuntu at gmail.com (Ward De Ridder) Date: Sun, 10 Feb 2008 02:35:56 +0100 Subject: [python-nl] tkinter In-Reply-To: <15391706.post@talk.nabble.com> References: <15391706.post@talk.nabble.com> Message-ID: <47AE54FC.6070905@gmail.com> frankje schreef: > Hallo, > > Ik gebruik linux ubuntu 7.10 en nou is mijn vraag hoe ik tkinter kan > opstarten... > > grtn, Frank > Beste, Tkinter is geen programma maar een bibliotheek in python en staat standaard ge?nstalleerd bij de installatie van ubuntu. Moest er toch iets misgelopen zijn en het pakket is niet ge?nstalleerd kunt u het installeren door in de terminal volgende regel te typen: sudo apt-get install python-tk meer info over Tkinter vindt u hier: http://wiki.python.org/moin/TkInter Ward De Ridder From WvanHeemstra at xs4all.nl Sun Feb 10 13:19:47 2008 From: WvanHeemstra at xs4all.nl (Willem van Heemstra) Date: Sun, 10 Feb 2008 12:19:47 +0000 Subject: [python-nl] Python Client for RabbitMQ Message Queuing software In-Reply-To: <47AE54FC.6070905@gmail.com> References: <15391706.post@talk.nabble.com> <47AE54FC.6070905@gmail.com> Message-ID: <1E979488-3FF4-4E79-8A8F-E2EBD77B6701@xs4all.nl> Hi all, I am developing a message queuing infrastructure with use of the open source software called rabbitmq (see http://www.rabbitmq.com/ ). I would be interested if any one of you have used it before, what is your experience, and has someone built a client in Python for it already? Thanks, Willem _______________________________________________ Python-nl mailing list Python-nl op python.org http://mail.python.org/mailman/listinfo/python-nl From egbert.bouwman at hccnet.nl Sun Feb 10 16:15:33 2008 From: egbert.bouwman at hccnet.nl (egbert) Date: Sun, 10 Feb 2008 16:15:33 +0100 Subject: [python-nl] print euro In-Reply-To: <7ae3ca10802080332n1e70df6yf93bb889ef50132f@mail.gmail.com> References: <20080207184500.GA6586@hccnet.nl> <20080207193758.GH39133@nexus.in-nomine.org> <20080207224107.GA14081@hccnet.nl> <20080208062602.GJ39133@nexus.in-nomine.org> <20080208100055.GA4938@hccnet.nl> <7ae3ca10802080332n1e70df6yf93bb889ef50132f@mail.gmail.com> Message-ID: <20080210151533.GA15607@hccnet.nl> On Fri, Feb 08, 2008 at 12:32:06PM +0100, Remco Gerlich wrote: Als je bijvoorbeeld UTF-8 kiest, dan moet je terminal, grafische console of programma dat dat bestand weergeeft, ook weten > dat het UTF-8 is, > dat aankunnen, > en een font gebruiken dat een euroteken bevat. Iets voor onder het hoofdkussen. Bedankt allemaal. e -- Egbert Bouwman - Keizersgracht 197 II - 1016 DS Amsterdam - 020 6257991 ========================================================================