Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 291331 - sys-apps/portage with USE=python3 cause error UnicodeEncodeError in smtplib.sendmail
Summary: sys-apps/portage with USE=python3 cause error UnicodeEncodeError in smtplib.s...
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks: 307597
  Show dependency tree
 
Reported: 2009-10-31 17:09 UTC by Sandro Bonazzola
Modified: 2010-03-08 10:34 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
fix the UnicodeEncodeError (mail_unicode.patch,726 bytes, patch)
2009-11-04 21:44 UTC, Zac Medico
Details | Diff
force ascii in order to avoid UnicodeEncodeError (force_ascii.patch,1.21 KB, patch)
2010-03-08 08:40 UTC, Zac Medico
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sandro Bonazzola 2009-10-31 17:09:48 UTC
Portage 2.1.7.2 (default/linux/amd64/10.0/desktop, gcc-4.4.2, glibc-2.10.1-r0, 2.6.31-gentoo-r4 x86_64)

during emerge -DuN world:

>>> Installing (2 of 80) x11-libs/gtk+-2.18.3
 * Please install app-text/evince for print preview functionality.
 * Alternatively, check "gtk-print-preview-command" documentation and
 * add it to your gtkrc.                                             
Traceback (most recent call last):                                   
  File "/usr/bin/emerge", line 42, in <module>                       
    retval = emerge_main()                                           
  File "/usr/lib64/portage/pym/_emerge/main.py", line 1358, in emerge_main
    myopts, myaction, myfiles, spinner)                                   
  File "/usr/lib64/portage/pym/_emerge/actions.py", line 409, in action_build
    retval = mergetask.merge()                                               
  File "/usr/lib64/portage/pym/_emerge/Scheduler.py", line 840, in merge     
    rval = self._merge()                                                     
  File "/usr/lib64/portage/pym/_emerge/Scheduler.py", line 1148, in _merge   
    self._main_loop()                                                        
  File "/usr/lib64/portage/pym/_emerge/Scheduler.py", line 1288, in _main_loop
    self._poll_loop()                                                         
  File "/usr/lib64/portage/pym/_emerge/PollScheduler.py", line 134, in _poll_loop
    handler(f, event)                                                            
  File "/usr/lib64/portage/pym/_emerge/SpawnProcess.py", line 192, in _output_handler
    self._unregister_if_appropriate(event)                                           
  File "/usr/lib64/portage/pym/_emerge/AbstractPollTask.py", line 27, in _unregister_if_appropriate
    self.wait()                                                                                    
  File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 42, in wait                      
    self._wait_hook()                                                                              
  File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 115, in _wait_hook               
    self._exit_listener_stack.pop()(self)                                                          
  File "/usr/lib64/portage/pym/_emerge/EbuildPhase.py", line 94, in _post_phase_exit               
    self.wait()                                                                                    
  File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 42, in wait                      
    self._wait_hook()                                                                              
  File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 115, in _wait_hook               
    self._exit_listener_stack.pop()(self)                                                          
  File "/usr/lib64/portage/pym/_emerge/TaskSequence.py", line 44, in _task_exit_handler            
    self.wait()                                                                                    
  File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 42, in wait                      
    self._wait_hook()                                                                              
  File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 115, in _wait_hook               
    self._exit_listener_stack.pop()(self)                                                          
  File "/usr/lib64/portage/pym/_emerge/CompositeTask.py", line 106, in _default_final_exit         
    return self.wait()                                                                             
  File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 42, in wait                      
    self._wait_hook()                                                                              
  File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 115, in _wait_hook               
    self._exit_listener_stack.pop()(self)                                                          
  File "/usr/lib64/portage/pym/_emerge/EbuildBuild.py", line 180, in _build_exit                   
    self.wait()                                                                                    
  File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 42, in wait                      
    self._wait_hook()                                                                              
  File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 115, in _wait_hook               
    self._exit_listener_stack.pop()(self)                                                          
  File "/usr/lib64/portage/pym/_emerge/CompositeTask.py", line 106, in _default_final_exit         
    return self.wait()                                                                             
  File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 42, in wait                      
    self._wait_hook()                                                                              
  File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 115, in _wait_hook               
    self._exit_listener_stack.pop()(self)                                                          
  File "/usr/lib64/portage/pym/_emerge/Scheduler.py", line 1127, in _build_exit                    
    self._schedule()                                                                               
  File "/usr/lib64/portage/pym/_emerge/PollScheduler.py", line 43, in _schedule                    
    return self._schedule_tasks()                                                                  
  File "/usr/lib64/portage/pym/_emerge/Scheduler.py", line 1317, in _schedule_tasks                
    if q.schedule():                                                                               
  File "/usr/lib64/portage/pym/_emerge/SequentialTaskQueue.py", line 56, in schedule               
    task.start()                                                                                   
  File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 24, in start                     
    self._start()                                                                                  
  File "/usr/lib64/portage/pym/_emerge/PackageMerge.py", line 44, in _start                        
    self.returncode = self.merge.merge()                                                           
  File "/usr/lib64/portage/pym/_emerge/MergeListItem.py", line 148, in merge                       
    retval = self._install_task.install()                                                          
  File "/usr/lib64/portage/pym/_emerge/EbuildBuild.py", line 271, in install                       
    rval = merge.execute()                                                                         
  File "/usr/lib64/portage/pym/_emerge/EbuildMerge.py", line 27, in execute                        
    blockers=self.find_blockers)                                                                   
  File "/usr/lib64/portage/pym/portage/__init__.py", line 7607, in merge                           
    mydbapi=mydbapi, prev_mtimes=prev_mtimes)                                                      
  File "/usr/lib64/portage/pym/portage/dbapi/vartree.py", line 3215, in merge                      
    mydbapi=mydbapi, prev_mtimes=prev_mtimes)                                                      
  File "/usr/lib64/portage/pym/portage/dbapi/vartree.py", line 3227, in _merge                     
    elog_process(self.mycpv, self.settings, phasefilter=filter_mergephases)                        
  File "/usr/lib64/portage/pym/portage/elog/__init__.py", line 165, in elog_process                
    m.process(mysettings, str(key), mod_logentries, mod_fulllog)                                   
  File "/usr/lib64/portage/pym/portage/elog/mod_mail.py", line 40, in process                      
    portage.mail.send_mail(mysettings, mymessage)                                                  
  File "/usr/lib64/portage/pym/portage/mail.py", line 130, in send_mail                            
    myconn.sendmail(myfrom, myrecipient, message.as_string())                                      
  File "/usr/lib64/python3.1/smtplib.py", line 718, in sendmail                                    
    (code,resp) = self.data(msg)                                                                   
  File "/usr/lib64/python3.1/smtplib.py", line 484, in data                                        
    self.send(q)                                                                                   
  File "/usr/lib64/python3.1/smtplib.py", line 305, in send                                        
    s = s.encode("ascii")                                                                          
UnicodeEncodeError: 'ascii' codec can't encode character '\u2018' in position 617: ordinal not in range(128)
Comment 1 Sandro Bonazzola 2009-10-31 17:10:06 UTC
# emerge --info                        
Portage 2.1.7.2 (default/linux/amd64/10.0/desktop, gcc-4.4.2, glibc-2.10.1-r0, 2.6.31-gentoo-r4 x86_64)
=================================================================                                      
System uname: Linux-2.6.31-gentoo-r4-x86_64-AMD_Athlon-tm-_64_Processor_3500+-with-gentoo-2.0.1        
Timestamp of tree: Sat, 31 Oct 2009 16:00:21 +0000                                                     
distcc 3.1 x86_64-pc-linux-gnu [disabled]                                                              
ccache version 2.4 [disabled]                                                                          
app-shells/bash:     4.0_p35                                                                           
dev-java/java-config: 1.3.7-r1, 2.1.9-r1                                                               
dev-lang/python:     2.6.4, 3.1.1-r1                                                                   
dev-python/pycrypto: 2.0.1-r8                                                                          
dev-util/ccache:     2.4-r8                                                                            
dev-util/cmake:      2.6.4-r3                                                                          
sys-apps/baselayout: 2.0.1                                                                             
sys-apps/openrc:     0.5.2-r1                                                                          
sys-apps/sandbox:    2.2                                                                               
sys-devel/autoconf:  2.13, 2.63-r1                                                                     
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10.2, 1.11                    
sys-devel/binutils:  2.20                                                                              
sys-devel/gcc-config: 1.4.1                                                                            
sys-devel/libtool:   2.2.6a                                                                            
virtual/os-headers:  2.6.30-r1                                                                         
ACCEPT_KEYWORDS="amd64 ~amd64"                                                                         
CBUILD="x86_64-pc-linux-gnu"                                                                           
CFLAGS="-march=athlon64 -O2 -pipe -fno-strict-aliasing"                                                
CHOST="x86_64-pc-linux-gnu"                                                                            
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/X11/xkb /usr/share/config /var/lib/hsqldb"                                                                                                 
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/initng/daemon /etc/initng/net /etc/initng/system /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/splash /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c /etc/udev/rules.d"                            
CXXFLAGS="-march=athlon64 -O2 -pipe -fno-strict-aliasing"                                                             
DISTDIR="/home/ftp/distfiles"                                                                                         
FEATURES="assume-digests cvs distlocks elog fixpackages java-strict metadata-transfer multilib-strict news parallel-fetch protect-owned sandbox sfperms strict unmerge-logs unmerge-orphans userfetch userpriv usersandbox"                 
GENTOO_MIRRORS="ftp://mirror.switch.ch/mirror/gentoo/"                                                                
LANG="it_IT.utf-8"                                                                                                    
LC_ALL="it_IT.utf-8"                                                                                                  
LDFLAGS="-Wl,-O1"                                                                                                     
LINGUAS="it"                                                                                                          
PKGDIR="/home/ftp/packages"                                                                                           
PORTAGE_COMPRESS="bzip2"                                                                                              
PORTAGE_COMPRESS_FLAGS="-9"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_EXTRA_OPTS=" --timeout=800 --progress "
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/overlays/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="3dnow 3dnowext 3ds 7zip X a52 aac acl acpi alsa amd64 amr apache2 audiofile avahi bash-completion berkdb bl branding bzip2 cairo cal3d caps ccache cdb cddb cdparanoia cdr cg chroot cli consolekit cpudetection cracklib crypt css cups curl custom-cflags dbus devhelp dga directfb disk-partition djvu dmi dovecot-sasl dri dts dv dvd dvdr dvdread emboss emerald encode epydoc erandom esd evo exif expat extrafilters fam fame ffmpeg firefox flac fltk foomaticdb fortran gd gdbm ggi gif gimp glib glibc-omitfp glitz glut gmp gnokii gnome gnutls gphoto2 gpm graphviz gsm gstreamer gtk gtkhtml guile hal hbci howl-compat iconv idn ieee1394 imagemagick imlib ipv6 isc isdnlog ithreads java java5 java6 javacomm javascript jbig jce jikes jpeg jpeg2k justify kde kdeenablefinal kdehiddenvisibility kqemu lcms ldap libcaca libnotify linuxthreads-tls lm_sensors logitech-mouse logrotate lzo mad mailwrapper matroska mbox mdb mhash mikmod mjpeg mmap mmx mmxext mng modules motif mozdevelop mp3 mp4 mpeg mppe-mppc msn mudflap multilib musepack musicbrainz mysql ncurses network-cron nfs nls nptl nptlonly nsplugin numeric nvidia odbc ode offensive ofx ogg ogre openexr opengl openmp oss pam parport pch pcre pdf perl php png povray ppds pppd print pulseaudio python qa qt3support qt4 quicktime quotes rdesktop readline reflection resolvconf restrict-javascript rtc samba scanner sdl semantic-desktop session slang slp smime sndfile snmp speex spell spl sse sse2 ssl startup-notification subversion svg sysfs syslog tcpd test tetex tga theora threads thunar tidy tiff timidity tk truetype unicode usb userlocales utempter v4l v4l2 vcd vda vorbis vorbis-psy wma wmf wmp x264 xattr xforms xine xinerama xml xorg xpm xprint xscreensaver xulrunner xv xvid xvmc yv12 zeroconf zlib" ALSA_CARDS="intel8x0" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" APACHE2_MPMS="worker" CAMERAS="canon directory panasonic pccam300 " ELIBC="glibc" FOO2ZJS_DEVICES="hp1005 hpp1005" INPUT_DEVICES="mouse evdev keyboard" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="it" USERLAND="GNU" VIDEO_CARDS="nvidia nv"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, MAKEOPTS
Comment 2 Zac Medico gentoo-dev 2009-11-04 21:44:40 UTC
Created attachment 209276 [details, diff]
fix the UnicodeEncodeError

If this patch is saved as /tmp/mail_unicode.patch, then it can be applied as follows:

  patch /usr/lib/portage/pym/portage/mail.py /tmp/mail_unicode.patch
Comment 3 Zac Medico gentoo-dev 2009-11-07 02:40:15 UTC
This is fixed in 2.1.7.4 and 2.2_rc49.
Comment 4 Graham Murray 2010-03-07 14:35:44 UTC
I am afraid that it looks like this problem is still present (or it has been re-introduced) in portage 22_rc65.

File "/usr/lib/portage/pym/portage/mail.py", line 138, in send_mail
    myconn.sendmail(myfrom, myrecipient, message.as_string())
  File "/usr/lib/python3.1/smtplib.py", line 718, in sendmail
    (code,resp) = self.data(msg)
  File "/usr/lib/python3.1/smtplib.py", line 484, in data
    self.send(q)
  File "/usr/lib/python3.1/smtplib.py", line 305, in send
    s = s.encode("ascii")
UnicodeEncodeError: 'ascii' codec can't encode character '\u2018' in position 465: ordinal not in range(128)
Comment 5 Zac Medico gentoo-dev 2010-03-08 08:12:02 UTC
(In reply to comment #4)
> I am afraid that it looks like this problem is still present (or it has been
> re-introduced) in portage 22_rc65.

It's something about the patch from bug 292528.
Comment 6 Zac Medico gentoo-dev 2010-03-08 08:40:48 UTC
Created attachment 222633 [details, diff]
force ascii in order to avoid UnicodeEncodeError

Save as /tmp/force_ascii.patch and apply as follows:

  patch /usr/lib/portage/pym/portage/mail.py /tmp/force_ascii.patch
Comment 7 Zac Medico gentoo-dev 2010-03-08 10:34:11 UTC
This is fixed in 2.1.8.2 and 2.2_rc66.