Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #79208

Re: what is the easiest way to install multiple Python versions?

Path csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-1.proxad.net!hq-usenetpeers.eweka.nl!hq-usenetpeers.eweka.nl!bcyclone02.am1.xlned.com!bcyclone02.am1.xlned.com!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <fomcl@yahoo.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.024
X-Spam-Evidence '*H*': 0.95; '*S*': 0.00; '16,': 0.03; 'subject:Python': 0.06; 'encode': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'def': 0.12; 'bug': 0.12; '2.7': 0.14; '"""print': 0.16; 'codec': 0.16; 'codecs': 0.16; 'log.': 0.16; 'ordinal': 0.16; 'subject:install': 0.16; 'subject:versions': 0.16; 'thursday,': 0.16; 'thu,': 0.19; 'import': 0.22; 'cc:addr:python.org': 0.22; 'print': 0.22; 'install': 0.23; 'error': 0.23; "aren't": 0.24; 'bytes': 0.24; 'unicode': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'skip:p 30': 0.29; 'character': 0.29; 'subject:what': 0.31; 'file': 0.32; 'run': 0.32; '(most': 0.33; '-----': 0.33; 'subject:the': 0.34; "can't": 0.35; 'anywhere': 0.35; 'skip:u 20': 0.35; 'case,': 0.35; 'convert': 0.35; 'but': 0.35; '2.6': 0.36; 'subject:?': 0.36; 'should': 0.36; 'easiest': 0.38; 'pm,': 0.38; 'recent': 0.39; 'does': 0.39; 'subject:': 0.39; 'though,': 0.39; 'skip:p 20': 0.39; 'skip:x 10': 0.40; 'skip:u 10': 0.60; 'easy': 0.60; 'received:98.137': 0.60; 'most': 0.60; 'break': 0.61; 'skip:o 30': 0.61; 'matter': 0.61; 're:': 0.63; 'to:addr:gmail.com': 0.65; 'between': 0.67; 'header:Reply-To:1': 0.67; 'received:gq1.yahoo.com': 0.68; 'received:mail.gq1.yahoo.com': 0.68; 'received:98.136': 0.69; "today's": 0.70; 'received:bullet.mail.gq1.yahoo.com': 0.84; 'differences': 0.93
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1413462712; bh=hwIeoNRNngM4dXOgW6dDrtLg0rpPSVutB2EbSEazPa4=; h=Date:From:Reply-To:To:Cc:In-Reply-To:References:Subject:From:Subject; b=K+7T4O9vxL6O7txc0MGAD8Ve4WEBXMcfr1R8TEWvNQgPVjvDHNPD7wHhbIwCPcdLlF1s3fhBgGPS01zVQgsEtuJwZ6ZoWqqcb6mfJg8P1cagrnooyd9POh4OJL3TY6zY6mS6W9GJszqGfH/9ufEhLl6e705LzMGUQNuSqNKrg5s6yUaxoNMJ5slBu4gFiVIifRbWwOtFTBlNvdbOGkbEmzp7fSAGYkHtEGi/Bo2kDzu3ba+k9uVdHicf9enk+f4oRvz2RxbwmHlaAGfYt6EKMzBU6Ef0KNHb00ts32nTVitMfiE9oIaYDG+2T5yBT5TcizGciWTuHeQbJBftMPAQiA==
DomainKey-Signature a=rsa-sha1; q=dns; c=nofws; s=s2048; d=yahoo.com; b=FArhal6TnX38j0dk+drfLqMeuekarRVclymZCABU6jJNlAk/sqO0cZuxTJFKSicr1+Z/2rPPrj7k9Znk8vqyfCME2xPaDtZDhS+MEI38xNdI0mQyyULI39QzA97kvzbrg9Mz7ep/wcNcwdUKiAYtO1twVdN+Ay4ZaGIDuW+EekDrJwuKz+DLFLS0jqsv8A0llz2pG9uqcHOQ3wOOJ7IY4pLR15sfFJvxUbOmitDir3YlM5OZ5VgLAiOROX4cIBsPh82HNjy9DQZeWGSdXJ4gFavIOBtbcIMSGRPZcsu1N0gMqaxOHGycMs6lo1coIrTL0zrw88Lre1t8b//SWzDoWQ==;
X-Yahoo-Newman-Property ymail-3
X-Yahoo-Newman-Id 573627.12631.bm@omp1008.mail.gq1.yahoo.com
X-YMail-OSG 7Xm_VP0VM1k3nhXlI7WE6wxXeawRQcC1mFe.pIA2KYBFeiQOnfmYF08IC848F2r DpbzntLNEQ4VwTsaMXAc1KdPgVPTmnHtq0ZWUF1Fd0F3Rv_8mZE03wXM75YZsyW883b_eWYW73pa E4ROCrlC0aSFv9PKilIGV8UBpBxFqGl5tHbmnAFJbNpTHFhfId0pQVLkCluCwT2QGTefxkvkECql L.hhaL_cYClJq5E6WgFgH9KACN.cdpcU3O0tPeS6QIch1hrTPCGudkQryFdGUzhH9jgEt37Uc0oN kZgfDea9z2fDTXcjyyVIKSMUGi751_kOO4IUl5Qn5lA_e12tKUhDuzoW2yLkvbzOIrM_0cTt1z9Z 6SfC0EDtcpBOfdYKfeLorIQfGHzbKQFpqOaoR8KcO6Q_hgDdKg2.OoJSV009ikdIBE4Xqppij.qD O8mklmoFor1RwCEf9wCrzCEiPw0B6uqkW9dDp44YWwGfEEWfKr2ecPl_L17RrNCmITv53aYL9eI2 wtfl8GHE2ieh25o3wh.3NI5QVDZz_7UxSA37eAZNo
Date Thu, 16 Oct 2014 12:31:29 +0000 (UTC)
From Albert-Jan Roskam <fomcl@yahoo.com>
To Chris Angelico <rosuav@gmail.com>
In-Reply-To <CAPTjJmoJhE3UH2bwAUj1uqSxqHBbs6NONojcz-L_gS8fzSD6vQ@mail.gmail.com>
References <CAPTjJmoJhE3UH2bwAUj1uqSxqHBbs6NONojcz-L_gS8fzSD6vQ@mail.gmail.com>
Subject Re: what is the easiest way to install multiple Python versions?
MIME-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 7bit
Cc Python <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
Reply-To Albert-Jan Roskam <fomcl@yahoo.com>
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.14922.1413462820.18130.python-list@python.org> (permalink)
Lines 43
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1413462820 news.xs4all.nl 2901 [2001:888:2000:d::a6]:52575
X-Complaints-To abuse@xs4all.nl
X-Received-Body-CRC 587865911
X-Received-Bytes 6646
Xref csiph.com comp.lang.python:79208

Show key headers only | View raw


----- Original Message -----

> From: Chris Angelico <rosuav@gmail.com>
> To: 
> Cc: Python <python-list@python.org>
> Sent: Thursday, October 16, 2014 10:48 AM
> Subject: Re: what is the easiest way to install multiple Python versions?
> 

> On Thu, Oct 16, 2014 at 7:42 PM, Albert-Jan Roskam <fomcl@yahoo.com> 


<snip>

> The differences between 2.6 and 2.7 aren't great, though,
> so you may well be able to port it trivially. But in any case, so long
> as you have Wheezy, you should be able to run 2.6 the easy way.


Most things were indeed easy to solve. But this one surprised me. With Python 2.6, I need to outcomment the 'lambda' line. The error is what I get in Python 2.6. It does not matter if I do u"\n".join(het_logboek[i:]). I don't use latin-1 anywhere in my program. I need to convert unicode to bytes in Python 2.6, or else it chokes in the smart quote.


import codecs
import os
import time


def print_log_van_vandaag(logbestand):
    """Print today's log. The Cron Daemon will mail this"""
    vandaag = time.strftime("%Y-%m-%d")
    with codecs.open(logbestand, encoding="utf-8") as logboek:
        het_logboek = logboek.readlines()
        #het_logboek = map(lambda x: x.encode("utf-8"), het_logboek)  # bug in Python 2.6?
        for i, regel in enumerate(het_logboek):
            if regel.startswith(vandaag):
                print os.linesep.join(het_logboek[i:])
                break
Traceback (most recent call last):
File "mailer.py", line 410, in <module>
print_log_van_vandaag("mailer.log")
File "mailer.py", line 399, in print_log_van_vandaag
print os.linesep.join(het_logboek[i:])
UnicodeEncodeError: 'latin-1' codec can't encode character u'\u2018' in position 10214: ordinal not in range(256)

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: what is the easiest way to install multiple Python versions? Albert-Jan Roskam <fomcl@yahoo.com> - 2014-10-16 12:31 +0000

csiph-web