LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices


Reply
  Search this Thread
Old 09-29-2012, 08:03 PM   #1
PeterSteele
Member
 
Registered: Jun 2012
Posts: 264

Rep: Reputation: Disabled
The createrepo operation fails with UnicodeDecodeError exception


I'm building a custom iso following the process described here, but when I run the command

createrepo -u “media://$discinfo” -g repodata/*comps.xml .

I get the following exception:

Code:
Traceback (most recent call last):
  File "/usr/share/createrepo/genpkgmetadata.py", line 249, in <module>
    main(sys.argv[1:])
  File "/usr/share/createrepo/genpkgmetadata.py", line 223, in main
    mdgen.doPkgMetadata()
  File "/usr/lib/python2.6/site-packages/createrepo/__init__.py", line 367, in doPkgMetadata
    self.writeMetadataDocs(packages)
  File "/usr/lib/python2.6/site-packages/createrepo/__init__.py", line 531, in writeMetadataDocs
    self.primaryfile.write(po.xml_dump_primary_metadata())
  File "/usr/lib/python2.6/site-packages/yum/packages.py", line 1206, in xml_dump_primary_metadata
    msg += misc.to_unicode(self._dump_base_items())
  File "/usr/lib/python2.6/site-packages/yum/packages.py", line 1045, in _dump_base_items
    msg += self._return_remote_location()
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 20: ordinal not in range(128)
Does anyone know what this error is caused by? My character set is UTF-8, and the operation is apparently trying to process a character code > 127 as an ASCII character. Before I go digging into Python code, can anyone explain what is happening here? I didn't actually make any changes to the iso. I just copied everything as is, without actually adding any of my own rpms at this point, and tried to recreate the iso with the original data.
 
Old 10-01-2012, 01:04 AM   #2
nugat
Member
 
Registered: Sep 2012
Posts: 122

Rep: Reputation: 31
Do you get the same error if you leave off the -g comps.xml bit? At least you would know if that was part of the problem...
 
Old 10-01-2012, 08:08 AM   #3
PeterSteele
Member
 
Registered: Jun 2012
Posts: 264

Original Poster
Rep: Reputation: Disabled
Well, the comps.xml is the primary input for the operation and my guess is that it is something in that file that the command is complaining about. That said, I tried taking off the -u option and the problem went away, and more importantly the custom iso I am creating appears to work okay.

The man page describes the -u option as:

Code:
       -u --baseurl <url>
              Optional base url location for all files. (not used by any clients at this time)
If there are no clients that make use of this option, it seemed reasonable to remove it.
 
Old 10-01-2012, 10:31 PM   #4
nugat
Member
 
Registered: Sep 2012
Posts: 122

Rep: Reputation: 31
Quote:
Originally Posted by PeterSteele View Post
Well, the comps.xml is the primary input for the operation and my guess is that it is something in that file that the command is complaining about. That said, I tried taking off the -u option and the problem went away, and more importantly the custom iso I am creating appears to work okay.
did you run the previous command in those steps, the one that creates the discinfo variable based upon the contents of the .discinfo file? anyway, i am able to replicate your error if I omit that step.

if I run it this way, it seems to work:

Code:
declare -x discinfo=`head -1 .discinfo`
echo $discinfo
createrepo -u "media://$discinfo" -g repodata/*comps.xml .
you just might have to supply the path to the .discinfo file in the first command. That file is in the root of the DVD/ISO image.
 
Old 10-02-2012, 12:00 AM   #5
PeterSteele
Member
 
Registered: Jun 2012
Posts: 264

Original Poster
Rep: Reputation: Disabled
Yes, I am following all of the steps. Not sure why it's giving me a hard time, but it's working fine with the -u option removed, so I guess I'll leave it at that. I suspect it's "user error" somewhere on my part...
 
Old 05-07-2013, 04:58 PM   #6
darrowco
LQ Newbie
 
Registered: May 2013
Posts: 1

Rep: Reputation: Disabled
Hope this saves someone some time, I had the same thing:

UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 20: ordinal not in range(128)

Turned out that the offending char was the double quotes in my cut'n'paste - oops.

createrepo -u “media://$discinfo” -g repodata/*comps.xml .

vs

createrepo -u "media://$discinfo" -g repodata/*comps.xml .
 
Old 05-07-2013, 06:47 PM   #7
PeterSteele
Member
 
Registered: Jun 2012
Posts: 264

Original Poster
Rep: Reputation: Disabled
This was not the cause in my case. I never did find the root cause, but my solution worked...
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
createrepo srinivasmmdl Linux - Newbie 1 10-02-2011 04:04 AM
[SOLVED] xsane rudely fails with floating point exception linuxbird Linux - Newbie 1 04-19-2010 12:29 AM
wxpython UnicodeDecodeError cs-cam Programming 0 02-07-2006 05:38 PM
help createing exception class from base STL exception qwijibow Programming 4 04-20-2005 05:23 AM
ifup-operation fails new-by Linux - Networking 1 09-25-2001 11:37 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

All times are GMT -5. The time now is 05:55 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration