From brett at python.org Tue Dec 2 16:34:56 2014 From: brett at python.org (Brett Cannon) Date: Tue, 02 Dec 2014 15:34:56 +0000 Subject: [Python-porting] Using speechd References: Message-ID: I assume you're talking about https://packages.debian.org/wheezy/python-speechd which looks like it has not been ported to Python 3. I would reach out to the developers and ask them when they plan on supporting Python 3. On Mon Dec 01 2014 at 1:12:20 PM Michael Cooper wrote: > I am using Python 3.4.1 with Idle 3.4.1. speechd seems to have > disappeared. Found solutions to a similar issue on google, but solution > does not work for me. When I reference speech I get an error indicating > the module does not exist. Is that a transition issue from 2 to 3? Cannot > find others with a similar issue, except the one - the suggested solution > was he upgrade to Idle3, which worked for him, but not me. Any help or > direction? > > > > Regards, > > Michael > > > > *Michael Cooper* > > USA > > [image: cid:image001.png at 01CFA0DC.ED484720] > > *+1 480 924 1220* O. > > *+1 602 510 6633 * M. > > mcooper at KRsearch.net > > www.KRsearch.com > > > > *We recruit leaders for organizations that feed the world and keep it > healthy.* > > > _______________________________________________ > Python-porting mailing list > Python-porting at python.org > https://mail.python.org/mailman/listinfo/python-porting > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image003.png Type: image/png Size: 133 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image004.png Type: image/png Size: 3821 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image004.png Type: image/png Size: 3821 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image003.png Type: image/png Size: 133 bytes Desc: not available URL: From ndbecker2 at gmail.com Fri Dec 12 15:06:58 2014 From: ndbecker2 at gmail.com (Neal Becker) Date: Fri, 12 Dec 2014 09:06:58 -0500 Subject: [Python-porting] future(ize) question Message-ID: I have code that has been run through a (several versions old) futurize. Can/should I try to futurize it again now that I have a newer version of future/futurize? Is this even possible? -- -- Those who don't understand recursion are doomed to repeat it From regebro at gmail.com Fri Dec 12 16:38:31 2014 From: regebro at gmail.com (Lennart Regebro) Date: Fri, 12 Dec 2014 16:38:31 +0100 Subject: [Python-porting] future(ize) question In-Reply-To: References: Message-ID: Yes, futurize won't touch code that already works under Python 3 (at least not in theory). I doubt that it's very useful though. The changes aren't likely to be that big. But you can run it without writing the changes to disk, and see what the differences are. On Fri, Dec 12, 2014 at 3:06 PM, Neal Becker wrote: > I have code that has been run through a (several versions old) futurize. > > Can/should I try to futurize it again now that I have a newer version of > future/futurize? Is this even possible? > > -- > -- Those who don't understand recursion are doomed to repeat it > > _______________________________________________ > Python-porting mailing list > Python-porting at python.org > https://mail.python.org/mailman/listinfo/python-porting From barry at python.org Wed Dec 17 02:26:57 2014 From: barry at python.org (Barry Warsaw) Date: Tue, 16 Dec 2014 20:26:57 -0500 Subject: [Python-porting] pickle data Message-ID: <20141216202657.78153c70@anarchist.wooz.org> Here's an interesting situation I am faced with as I port Mailman 3 to Python 3. I haven't seen any other discussion of it, so I thought I'd post here for posterity. Let's say you have a pickle created in Python 2 that is to be read in Python 3. In Mailman 2, persistent mailing list data is stored in pickles. It seems like both Python 2 types (unicode and str/bytes) get unpickled as Python 3 str types. It makes sense because: * Python 2 unicode should unpickle as Python 3 str * In Python 2, bytes are just an alias for str * There's no way to know the intent of whether Python 2 "bytes" should be unpickled as Python 3 bytes or str. Code: -----put.py----- from six.moves.cPickle import dump d = { b'b': b'b', u'u': u'u', 's': 's', } with open('/tmp/foo.pck', 'wb') as fp: dump(d, fp) -----put.py----- -----get.py----- from pprint import pprint from six.moves.cPickle import load with open('/tmp/foo.pck', 'rb') as fp: d = load(fp) pprint(d) -----get.py----- $ python2 /tmp/put.py $ python3 /tmp/get.py {'b': 'b', 's': 's', 'u': 'u'} $ python2 /tmp/get.py {'b': 'b', 's': 's', u'u': u'u'} Cheers, -Barry -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 819 bytes Desc: OpenPGP digital signature URL: From benjamin at python.org Wed Dec 17 02:32:40 2014 From: benjamin at python.org (Benjamin Peterson) Date: Tue, 16 Dec 2014 20:32:40 -0500 Subject: [Python-porting] pickle data In-Reply-To: <20141216202657.78153c70@anarchist.wooz.org> References: <20141216202657.78153c70@anarchist.wooz.org> Message-ID: <1418779960.862449.203788917.5D431723@webmail.messagingengine.com> On Tue, Dec 16, 2014, at 20:26, Barry Warsaw wrote: > Here's an interesting situation I am faced with as I port Mailman 3 to > Python > 3. I haven't seen any other discussion of it, so I thought I'd post here > for > posterity. > > Let's say you have a pickle created in Python 2 that is to be read in > Python > 3. In Mailman 2, persistent mailing list data is stored in pickles. > > It seems like both Python 2 types (unicode and str/bytes) get unpickled > as > Python 3 str types. You can change this by passing encoding="bytes" to pickle.loads. See https://docs.python.org/3/library/pickle.html#pickle.load > > * Python 2 unicode should unpickle as Python 3 str > * In Python 2, bytes are just an alias for str > * There's no way to know the intent of whether Python 2 "bytes" should be > unpickled as Python 3 bytes or str. Yeah, this is problematic. Probably the best you can do is unpickle everything with bytes then manually decode actual string things into str. From greg at krypto.org Mon Dec 22 17:50:30 2014 From: greg at krypto.org (Gregory P. Smith) Date: Mon, 22 Dec 2014 16:50:30 +0000 Subject: [Python-porting] pickle data References: <20141216202657.78153c70@anarchist.wooz.org> <1418779960.862449.203788917.5D431723@webmail.messagingengine.com> Message-ID: Or update your Python 2 code to save its data in a proper well defined language agnostic portable data format instead of a pickle. Pickles are definitely a problem. My own advice is to never use them for anything you don't mind throwing away (ie: simple caches). On Tue Dec 16 2014 at 5:32:55 PM Benjamin Peterson wrote: > > > On Tue, Dec 16, 2014, at 20:26, Barry Warsaw wrote: > > Here's an interesting situation I am faced with as I port Mailman 3 to > > Python > > 3. I haven't seen any other discussion of it, so I thought I'd post here > > for > > posterity. > > > > Let's say you have a pickle created in Python 2 that is to be read in > > Python > > 3. In Mailman 2, persistent mailing list data is stored in pickles. > > > > It seems like both Python 2 types (unicode and str/bytes) get unpickled > > as > > Python 3 str types. > > You can change this by passing encoding="bytes" to pickle.loads. See > https://docs.python.org/3/library/pickle.html#pickle.load > > > > > * Python 2 unicode should unpickle as Python 3 str > > * In Python 2, bytes are just an alias for str > > * There's no way to know the intent of whether Python 2 "bytes" should be > > unpickled as Python 3 bytes or str. > > Yeah, this is problematic. Probably the best you can do is unpickle > everything with bytes then manually decode actual string things into > str. > _______________________________________________ > Python-porting mailing list > Python-porting at python.org > https://mail.python.org/mailman/listinfo/python-porting > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ndbecker2 at gmail.com Tue Dec 23 17:39:10 2014 From: ndbecker2 at gmail.com (Neal Becker) Date: Tue, 23 Dec 2014 11:39:10 -0500 Subject: [Python-porting] pickle data References: <20141216202657.78153c70@anarchist.wooz.org> <1418779960.862449.203788917.5D431723@webmail.messagingengine.com> Message-ID: Gregory P. Smith wrote: > Or update your Python 2 code to save its data in a proper well defined > language agnostic portable data format instead of a pickle. Pickles are > definitely a problem. My own advice is to never use them for anything you > don't mind throwing away (ie: simple caches). > Such as? From greg at krypto.org Tue Dec 23 21:12:53 2014 From: greg at krypto.org (Gregory P. Smith) Date: Tue, 23 Dec 2014 20:12:53 +0000 Subject: [Python-porting] pickle data References: <20141216202657.78153c70@anarchist.wooz.org> <1418779960.862449.203788917.5D431723@webmail.messagingengine.com> Message-ID: JSON is popular and well supported by virtually everyone. Myself, I prefer data formats with an explicit schema. But those are much heavier weight (Protocol Buffers, Thrift, etc). You can bolt a schema onto JSON. Any code serializing as such effectively already is. Unless they declare the structure, field names and types somewhere the definition is just the implementation code... which tends to change over time without necessarily thinking about the schema, leading to problems. Thus why I like having a well defined schema for storage. :) On Tue Dec 23 2014 at 8:39:35 AM Neal Becker wrote: > Gregory P. Smith wrote: > > > Or update your Python 2 code to save its data in a proper well defined > > language agnostic portable data format instead of a pickle. Pickles are > > definitely a problem. My own advice is to never use them for anything you > > don't mind throwing away (ie: simple caches). > > > > Such as? > > > _______________________________________________ > Python-porting mailing list > Python-porting at python.org > https://mail.python.org/mailman/listinfo/python-porting > -------------- next part -------------- An HTML attachment was scrubbed... URL: From barry at python.org Tue Dec 23 21:52:07 2014 From: barry at python.org (Barry Warsaw) Date: Tue, 23 Dec 2014 15:52:07 -0500 Subject: [Python-porting] pickle data In-Reply-To: References: <20141216202657.78153c70@anarchist.wooz.org> <1418779960.862449.203788917.5D431723@webmail.messagingengine.com> Message-ID: <20141223155207.07f4020c@anthem> On Dec 23, 2014, at 08:12 PM, Gregory P. Smith wrote: >JSON is popular and well supported by virtually everyone. AFAICT, JSON won't preserve the differences between bytes and unicodes in Python 2, so it also can't restore the equivalent types to Python 3. -Barry From sandro.tosi at gmail.com Tue Dec 2 17:07:54 2014 From: sandro.tosi at gmail.com (Sandro Tosi) Date: Tue, 02 Dec 2014 16:07:54 -0000 Subject: [Python-porting] Using speechd In-Reply-To: References: Message-ID: Hi, in the Debian world the py3k speechd module is available since Jessie (the current testing, soon-to-be-stable): https://packages.debian.org/jessie/python3-speechd (so yes, the upstream module is py3k compatible). On Tue, Dec 2, 2014 at 3:34 PM, Brett Cannon wrote: > I assume you're talking about > https://packages.debian.org/wheezy/python-speechd which looks like it has > not been ported to Python 3. I would reach out to the developers and ask > them when they plan on supporting Python 3. > > On Mon Dec 01 2014 at 1:12:20 PM Michael Cooper > wrote: > >> I am using Python 3.4.1 with Idle 3.4.1. speechd seems to have >> disappeared. Found solutions to a similar issue on google, but solution >> does not work for me. When I reference speech I get an error indicating >> the module does not exist. Is that a transition issue from 2 to 3? Cannot >> find others with a similar issue, except the one - the suggested solution >> was he upgrade to Idle3, which worked for him, but not me. Any help or >> direction? >> >> >> >> Regards, >> >> Michael >> >> >> >> *Michael Cooper* >> >> USA >> >> [image: cid:image001.png at 01CFA0DC.ED484720] >> >> *+1 480 924 1220 <%2B1%20480%20924%201220>* O. >> >> *+1 602 510 6633 <%2B1%20602%20510%206633> * M. >> >> mcooper at KRsearch.net >> >> www.KRsearch.com >> >> >> >> >> *We recruit leaders for organizations that feed the world and keep it >> healthy.* >> >> >> _______________________________________________ >> Python-porting mailing list >> Python-porting at python.org >> https://mail.python.org/mailman/listinfo/python-porting >> > > _______________________________________________ > Python-porting mailing list > Python-porting at python.org > https://mail.python.org/mailman/listinfo/python-porting > > -- > > Sandro Tosi (aka morph, morpheus, matrixhasu) > My website: > http://matrixhasu.altervista.org/ > Me at Debian: http://wiki.debian.org/SandroTosi > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image003.png Type: image/png Size: 133 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image004.png Type: image/png Size: 3821 bytes Desc: not available URL: From bcannon at gmail.com Fri Dec 5 22:12:23 2014 From: bcannon at gmail.com (Brett Cannon) Date: Fri, 05 Dec 2014 21:12:23 -0000 Subject: [Python-porting] Python 2/3 porting HOWTO has been updated Message-ID: It now promotes using tooling as much as possible to automate the process of making code by Python 2/3 source-compatible: https://docs.python.org/3.5/howto/pyporting.html Blog post about it at http://nothingbutsnark.svbtle.com/commentary-on-getting-your-code-to-run-on-python-23 . -------------- next part -------------- An HTML attachment was scrubbed... URL: From mcooper at krsearch.net Sun Dec 7 18:35:39 2014 From: mcooper at krsearch.net (Michael Cooper) Date: Sun, 07 Dec 2014 17:35:39 -0000 Subject: [Python-porting] Using speechd In-Reply-To: References: Message-ID: Thank you Brett and Sandro. I am new to Python and I am enjoying learning. I will try the connection you noted. Kind Regards, Michael Michael Cooper Managing Director USA [cid:image001.png at 01CF444A.D93B3B00] +1 480 924 1220 O. +1 602 510 6633 M. mcooper at KRsearch.net http://www.KRsearch.com/ We recruit leaders for organizations that feed the world and keep it healthy. From: Sandro Tosi [mailto:sandro.tosi at gmail.com] Sent: Tuesday, December 02, 2014 9:07 AM To: Brett Cannon Cc: Michael Cooper; python-porting at python.org Subject: Re: [Python-porting] Using speechd Hi, in the Debian world the py3k speechd module is available since Jessie (the current testing, soon-to-be-stable): https://packages.debian.org/jessie/python3-speechd (so yes, the upstream module is py3k compatible). On Tue, Dec 2, 2014 at 3:34 PM, Brett Cannon > wrote: I assume you're talking about https://packages.debian.org/wheezy/python-speechd which looks like it has not been ported to Python 3. I would reach out to the developers and ask them when they plan on supporting Python 3. On Mon Dec 01 2014 at 1:12:20 PM Michael Cooper > wrote: I am using Python 3.4.1 with Idle 3.4.1. speechd seems to have disappeared. Found solutions to a similar issue on google, but solution does not work for me. When I reference speech I get an error indicating the module does not exist. Is that a transition issue from 2 to 3? Cannot find others with a similar issue, except the one - the suggested solution was he upgrade to Idle3, which worked for him, but not me. Any help or direction? Regards, Michael Michael Cooper USA [cid:image001.png at 01CFA0DC.ED484720] +1 480 924 1220 O. +1 602 510 6633 M. mcooper at KRsearch.net www.KRsearch.com We recruit leaders for organizations that feed the world and keep it healthy. _______________________________________________ Python-porting mailing list Python-porting at python.org https://mail.python.org/mailman/listinfo/python-porting _______________________________________________ Python-porting mailing list Python-porting at python.org https://mail.python.org/mailman/listinfo/python-porting -- Sandro Tosi (aka morph, morpheus, matrixhasu) My website: http://matrixhasu.altervista.org/ Me at Debian: http://wiki.debian.org/SandroTosi -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image001.png Type: image/png Size: 4463 bytes Desc: image001.png URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image002.png Type: image/png Size: 133 bytes Desc: image002.png URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image003.png Type: image/png Size: 3821 bytes Desc: image003.png URL: