Peter's Blog

Redefining the Impossible

Posts made during July 2004


I am in the process of installing Gentoo linux on a PC at work and also an old pc at home (the joys of ssh). Over the years I have installed Slackware, Redhat, Suse and Debian but none of those was as complex as installing Gentoo. The handbook is absolutely essential and it is probably best to read it through before starting (tip: install stage 3).

Installation is not just running a setup program, it is down to the basics of mounting file systems, chrooting, untarring, building kernels etc. I have learnt a lot from it and I now think I am competant enough to fix a broken linux system from a boot floppy. I had to install Gentoo this way as the Gentoo CD would not boot and I had to find some linux boot floppies to get things rolling.

Setting it up takes ages as it is building most things from source. The USE preferences variable allowed me to tell it I want perl and python but not ruby. I ran an emerge vim to get vim installed and, to my surprise, I got VIM 6.3 (which I didn't know was out) with python and perl support built in!

I haven't set up X yet. I may do it at home as an exercise but I dread to think how long it will take. You are supposed to be able to install precompiled packages but at my one attempt (lilo) it still spent 20 minutes compiling it from source.

Gentoo in a nutshell:

  • Don't think about it unless you have broadband
  • Don't think about it unless you are happy at a command prompt
  • Don't think about it unless you are patient

    Gentoo: something to do in the background while reading RSS feeds.


Filed under: gentoo linux python rss ssh vim

Add a comment

I've tried the Python Desktop Server package in Gentoo and had problems with the Wiki. Trying to look at a Wiki entry would give an error like this:

 Exception exceptions.AttributeError: HTMLFragmentWriter instance has no attribute 'visitor' File                 Line      Function         Source Tool.py              935       process_request  s = getattr(tool,meth)(req) WikiTool.py          376       show_html        homeTool = self) Tool.py              744       renderText       homeTool=kw.get('homeTool') StructuredText.py    201       renderText       settings_overrides={ core.py              382       publish_string   return pub.publish(enable_exit=enable_exit) core.py              186       publish          self.writer.assemble_parts() html4css1.py         115       assemble_parts   self.partspart = ''.join(getattr(self.visitor, part)) 

(note that I had to force traceback dumping in docutils to get this much detail. I did this by adding self.settings.traceback = 1 to publisher.publish).

Poking around, the problem appears to be with the new version of docutils (which appears to be dev-python/docutils-0.3-r1 0.3.3). The problem is that the code in html4css1.Writer.Translate has changed from:

I've tried the Python Desktop Server package in Gentoo and had problems with the Wiki. Trying to look at a Wiki entry would give an error like this:

 Exception exceptions.AttributeError: HTMLFragmentWriter instance has no attribute 'visitor' File                 Line      Function         Source Tool.py              935       process_request  s = getattr(tool,meth)(req) WikiTool.py          376       show_html        homeTool = self) Tool.py              744       renderText       homeTool=kw.get('homeTool') StructuredText.py    201       renderText       settings_overrides={ core.py              382       publish_string   return pub.publish(enable_exit=enable_exit) core.py              186       publish          self.writer.assemble_parts() html4css1.py         115       assemble_parts   self.partspart = ''.join(getattr(self.visitor, part)) 

(note that I had to force traceback dumping in docutils to get this much detail. I did this by adding self.settings.traceback = 1 to publisher.publish).

Poking around, the problem appears to be with the new version of docutils (which appears to be dev-python/docutils-0.3-r1 0.3.3). The problem is that the code in html4css1.Writer.Translate has changed from:

def translate(self):
    
visitor = self.translator_class(self.document)
    
self.document.walkabout(visitor)
    
self.output = visitor.astext()
    
self.head_prefix = visitor.head_prefix
    
self.stylesheet = visitor.stylesheet
    
self.head = visitor.head
    
self.body_prefix = visitor.body_prefix
    
self.body_pre_docinfo = visitor.body_pre_docinfo
    
self.docinfo = visitor.docinfo
    
self.body = visitor.body
    
self.body_suffix = visitor.body_suffix

to:

I've tried the Python Desktop Server package in Gentoo and had problems with the Wiki. Trying to look at a Wiki entry would give an error like this:

 Exception exceptions.AttributeError: HTMLFragmentWriter instance has no attribute 'visitor' File                 Line      Function         Source Tool.py              935       process_request  s = getattr(tool,meth)(req) WikiTool.py          376       show_html        homeTool = self) Tool.py              744       renderText       homeTool=kw.get('homeTool') StructuredText.py    201       renderText       settings_overrides={ core.py              382       publish_string   return pub.publish(enable_exit=enable_exit) core.py              186       publish          self.writer.assemble_parts() html4css1.py         115       assemble_parts   self.partspart = ''.join(getattr(self.visitor, part)) 

(note that I had to force traceback dumping in docutils to get this much detail. I did this by adding self.settings.traceback = 1 to publisher.publish).

Poking around, the problem appears to be with the new version of docutils (which appears to be dev-python/docutils-0.3-r1 0.3.3). The problem is that the code in html4css1.Writer.Translate has changed from:

def translate(self):
    
visitor = self.translator_class(self.document)
    
self.document.walkabout(visitor)
    
self.output = visitor.astext()
    
self.head_prefix = visitor.head_prefix
    
self.stylesheet = visitor.stylesheet
    
self.head = visitor.head
    
self.body_prefix = visitor.body_prefix
    
self.body_pre_docinfo = visitor.body_pre_docinfo
    
self.docinfo = visitor.docinfo
    
self.body = visitor.body
    
self.body_suffix = visitor.body_suffix

to:

def translate(self):
    
visitor = self.translator_class(self.document)
    
self.document.walkabout(visitor)
    
self.output = visitor.astext()
    
self.visitor = visitor
    
for attr in ('head_prefix', 'stylesheet', 'head', 'body_prefix',
                 
'body_pre_docinfo', 'docinfo', 'body', 'fragment',
                 
'body_suffix'):
        
setattr(self, attr, getattr(visitor, attr))

Hidden in the new form is the line:

I've tried the Python Desktop Server package in Gentoo and had problems with the Wiki. Trying to look at a Wiki entry would give an error like this:

 Exception exceptions.AttributeError: HTMLFragmentWriter instance has no attribute 'visitor' File                 Line      Function         Source Tool.py              935       process_request  s = getattr(tool,meth)(req) WikiTool.py          376       show_html        homeTool = self) Tool.py              744       renderText       homeTool=kw.get('homeTool') StructuredText.py    201       renderText       settings_overrides={ core.py              382       publish_string   return pub.publish(enable_exit=enable_exit) core.py              186       publish          self.writer.assemble_parts() html4css1.py         115       assemble_parts   self.partspart = ''.join(getattr(self.visitor, part)) 

(note that I had to force traceback dumping in docutils to get this much detail. I did this by adding self.settings.traceback = 1 to publisher.publish).

Poking around, the problem appears to be with the new version of docutils (which appears to be dev-python/docutils-0.3-r1 0.3.3). The problem is that the code in html4css1.Writer.Translate has changed from:

def translate(self):
    
visitor = self.translator_class(self.document)
    
self.document.walkabout(visitor)
    
self.output = visitor.astext()
    
self.head_prefix = visitor.head_prefix
    
self.stylesheet = visitor.stylesheet
    
self.head = visitor.head
    
self.body_prefix = visitor.body_prefix
    
self.body_pre_docinfo = visitor.body_pre_docinfo
    
self.docinfo = visitor.docinfo
    
self.body = visitor.body
    
self.body_suffix = visitor.body_suffix

to:

def translate(self):
    
visitor = self.translator_class(self.document)
    
self.document.walkabout(visitor)
    
self.output = visitor.astext()
    
self.visitor = visitor
    
for attr in ('head_prefix', 'stylesheet', 'head', 'body_prefix',
                 
'body_pre_docinfo', 'docinfo', 'body', 'fragment',
                 
'body_suffix'):
        
setattr(self, attr, getattr(visitor, attr))

Hidden in the new form is the line:

self.visitor = visitor

This is not being done in the PyDS version of this function HTMLFragmentWriter.translate:

I've tried the Python Desktop Server package in Gentoo and had problems with the Wiki. Trying to look at a Wiki entry would give an error like this:

 Exception exceptions.AttributeError: HTMLFragmentWriter instance has no attribute 'visitor' File                 Line      Function         Source Tool.py              935       process_request  s = getattr(tool,meth)(req) WikiTool.py          376       show_html        homeTool = self) Tool.py              744       renderText       homeTool=kw.get('homeTool') StructuredText.py    201       renderText       settings_overrides={ core.py              382       publish_string   return pub.publish(enable_exit=enable_exit) core.py              186       publish          self.writer.assemble_parts() html4css1.py         115       assemble_parts   self.partspart = ''.join(getattr(self.visitor, part)) 

(note that I had to force traceback dumping in docutils to get this much detail. I did this by adding self.settings.traceback = 1 to publisher.publish).

Poking around, the problem appears to be with the new version of docutils (which appears to be dev-python/docutils-0.3-r1 0.3.3). The problem is that the code in html4css1.Writer.Translate has changed from:

def translate(self):
    
visitor = self.translator_class(self.document)
    
self.document.walkabout(visitor)
    
self.output = visitor.astext()
    
self.head_prefix = visitor.head_prefix
    
self.stylesheet = visitor.stylesheet
    
self.head = visitor.head
    
self.body_prefix = visitor.body_prefix
    
self.body_pre_docinfo = visitor.body_pre_docinfo
    
self.docinfo = visitor.docinfo
    
self.body = visitor.body
    
self.body_suffix = visitor.body_suffix

to:

def translate(self):
    
visitor = self.translator_class(self.document)
    
self.document.walkabout(visitor)
    
self.output = visitor.astext()
    
self.visitor = visitor
    
for attr in ('head_prefix', 'stylesheet', 'head', 'body_prefix',
                 
'body_pre_docinfo', 'docinfo', 'body', 'fragment',
                 
'body_suffix'):
        
setattr(self, attr, getattr(visitor, attr))

Hidden in the new form is the line:

self.visitor = visitor

This is not being done in the PyDS version of this function HTMLFragmentWriter.translate:

def translate(self):
    
visitor = self.translator_class(self.document,
        
section_level=self.section_level,
        
suppress_paragraphs=self.suppress_paragraphs
    
)
    
self.document.walkabout(visitor)
    
self.output = visitor.astext()
    
self.head_prefix = visitor.head_prefix
    
self.head = visitor.head
    
self.body_prefix = visitor.body_prefix
    
self.body = visitor.body
    
self.body_suffix = visitor.body_suffix

Adding the following line:

I've tried the Python Desktop Server package in Gentoo and had problems with the Wiki. Trying to look at a Wiki entry would give an error like this:

 Exception exceptions.AttributeError: HTMLFragmentWriter instance has no attribute 'visitor' File                 Line      Function         Source Tool.py              935       process_request  s = getattr(tool,meth)(req) WikiTool.py          376       show_html        homeTool = self) Tool.py              744       renderText       homeTool=kw.get('homeTool') StructuredText.py    201       renderText       settings_overrides={ core.py              382       publish_string   return pub.publish(enable_exit=enable_exit) core.py              186       publish          self.writer.assemble_parts() html4css1.py         115       assemble_parts   self.partspart = ''.join(getattr(self.visitor, part)) 

(note that I had to force traceback dumping in docutils to get this much detail. I did this by adding self.settings.traceback = 1 to publisher.publish).

Poking around, the problem appears to be with the new version of docutils (which appears to be dev-python/docutils-0.3-r1 0.3.3). The problem is that the code in html4css1.Writer.Translate has changed from:

def translate(self):
    
visitor = self.translator_class(self.document)
    
self.document.walkabout(visitor)
    
self.output = visitor.astext()
    
self.head_prefix = visitor.head_prefix
    
self.stylesheet = visitor.stylesheet
    
self.head = visitor.head
    
self.body_prefix = visitor.body_prefix
    
self.body_pre_docinfo = visitor.body_pre_docinfo
    
self.docinfo = visitor.docinfo
    
self.body = visitor.body
    
self.body_suffix = visitor.body_suffix

to:

def translate(self):
    
visitor = self.translator_class(self.document)
    
self.document.walkabout(visitor)
    
self.output = visitor.astext()
    
self.visitor = visitor
    
for attr in ('head_prefix', 'stylesheet', 'head', 'body_prefix',
                 
'body_pre_docinfo', 'docinfo', 'body', 'fragment',
                 
'body_suffix'):
        
setattr(self, attr, getattr(visitor, attr))

Hidden in the new form is the line:

self.visitor = visitor

This is not being done in the PyDS version of this function HTMLFragmentWriter.translate:

def translate(self):
    
visitor = self.translator_class(self.document,
        
section_level=self.section_level,
        
suppress_paragraphs=self.suppress_paragraphs
    
)
    
self.document.walkabout(visitor)
    
self.output = visitor.astext()
    
self.head_prefix = visitor.head_prefix
    
self.head = visitor.head
    
self.body_prefix = visitor.body_prefix
    
self.body = visitor.body
    
self.body_suffix = visitor.body_suffix

Adding the following line:

self.visitor = visitor

to this seems to fix the Wiki problem. Sorry for lack of diffs, patches or whatever. I'm taking baby steps in OSS development.

The Mesh tool is still broken. It gives:

 Exception exceptions.KeyError: '__hash__' File             Line  Function         Source Tool.py          915   process_request  s = tool.index_html(req) MeshTool.py      855   index_html       toolHasSigtool = False NuggetsTool.py   263   __getattr__      else: raise KeyError(name) 

I may look into this some other time. I don't use the mesh tool as I'm not sure what it does.

I've tried the Python Desktop Server package in Gentoo and had problems with the Wiki. Trying to look at a Wiki entry would give an error like this:

 Exception exceptions.AttributeError: HTMLFragmentWriter instance has no attribute 'visitor' File                 Line      Function         Source Tool.py              935       process_request  s = getattr(tool,meth)(req) WikiTool.py          376       show_html        homeTool = self) Tool.py              744       renderText       homeTool=kw.get('homeTool') StructuredText.py    201       renderText       settings_overrides={ core.py              382       publish_string   return pub.publish(enable_exit=enable_exit) core.py              186       publish          self.writer.assemble_parts() html4css1.py         115       assemble_parts   self.partspart = ''.join(getattr(self.visitor, part)) 

(note that I had to force traceback dumping in docutils to get this much detail. I did this by adding self.settings.traceback = 1 to publisher.publish).

Poking around, the problem appears to be with the new version of docutils (which appears to be dev-python/docutils-0.3-r1 0.3.3). The problem is that the code in html4css1.Writer.Translate has changed from:

def translate(self):
    
visitor = self.translator_class(self.document)
    
self.document.walkabout(visitor)
    
self.output = visitor.astext()
    
self.head_prefix = visitor.head_prefix
    
self.stylesheet = visitor.stylesheet
    
self.head = visitor.head
    
self.body_prefix = visitor.body_prefix
    
self.body_pre_docinfo = visitor.body_pre_docinfo
    
self.docinfo =&nbs

Filed under: baby gentoo linux pyds python

Add a comment

First post from Python Desktop Server running on my new server under Gentoo. If you can read this then it is working!

I think I'm uncovering a little shortcoming of Gentoo. I had to tweak the source for PyDS to get this running and I cannot install PHP because the build fails.

Does a Gentoo user spend most of their time fixing bugs???


Filed under: gentoo linux php pyds python

Add a comment

New server running, sshing to work and it's nice much faster that the old laptop was. It also runs quiter, the old laptop fan did not come on all the time but when it did it was like a vacuum cleaner. Yeah Gentoo.


Filed under: gentoo linux

Add a comment

I was settling down to my lunchtime RSS trawl when to my horror I found no entries. Going into the PyDS Aggregator configuration I found that all my feeds had failed to download. I got a stack trace out of it which said:

There was an error when downloading the feed
Exception "exceptions.AttributeError: 'NoneType' object has no attribute 'lower'"
/usr/lib/python2.3/site-packages/PyDS/AggregatorTool.py[1560] in updateFeed
/usr/lib/python2.3/site-packages/PyDS/DownstreamTool.py[551] in download
/usr/lib/python2.3/site-packages/PyDS/DownstreamTool.py[364] in _download
/usr/lib/python2.3/urllib.py[181] in open
/usr/lib/python2.3/site-packages/PyDS/DownstreamTool.py[80] in open_http
/usr/lib/python2.3/urllib.py[269] in open_http

I think this one is caused by an incompatability between PyDS 0.7.2 and the version of urllib.py in Python 2.3.3. The function urllib.URLOpener.open_http seems to have changed a lot and it has broken the derived version in DownstreamTool.UrlOpener.open_http.

The quick fix for me was to rename DownstreamTool.UrlOpener.open_http to hide_open_http so that the version in urllib would be used. This worked and I now have 125 items to read.

This fix is obviously a hack, it'll only work for urls that start with 'http' (i.e. all mine), 'file' may still be broken. The proper fix would be to review the differences between the pyds version of UrlOpener and the new urllib version but that is beyond me as I don't even know why pyds has it's own urlopener.

Again it's my fault for using Gentoo and not using PyDS with the 'approved' versions of other libraries.


Filed under: gentoo linux pyds python rss

Add a comment

Georg Bauer commented on my hack P376 yesterday to say:

Georg Bauer commented on my hack P376 yesterday to say:

"your hack has disabled conditional GET completely, so you now pull down feeds every hour fully. This might get you some angry comments if somebody finds out wink"

I decided to investigate further. The problem boils down to this code in DownstreamTool.open_http:

def open_http(self, url, data=None):
    
numheaders = len(self.addheaders)
    
self.isHTTP = 1
    
self.lastURL = self.getTheUrl(url)
    
try:
        
theurl = self.getTheUrl(url)
        
self.message = _('opening url: <a href="%s">%s</a>') % (theurl, theurl)
        
if not(self.force):
            
for h in self.cache._getUrlHeaders(theurl):
                
apply(self.addheader, h)
                
self.message += _('<br>adding Header "%s: %s"') % h
        
urlpieces = urlparse.urlparse(url1">1)
        
url = (urlpieces1">1, url1">1)
        
res = urllib.URLopener.open_http(self, url, data)
        
self.message = self.message.replace('%', '%%')
        
<snip>

It turns out that this code is DIFFERENT to the same code on my old PyDS install although BOTH are supposed to be 0.7.2 (they both say it at the top of the screen). The two lines:

urlpieces = urlparse.urlparse(url1">1)
url = (urlpieces1">1, url1">1)

have been added in the Gentoo version. The problem seems to be that the variable url may be either a simple string or a tuple and the new code is assuming that it is a tuple when it is actually a string. I don't know precisely what the new code is supposed to be doing but taking it out fixes the problem.

Georg mentioned that I am repeatedly downloading articles and I did notice this effect but I was seeing duplicate entries before (particularly from the BBC) so I was accustomed to skipping past them.

Still, why is the PyDS version 0.7.2 in Gentoo different from my old version of 0.7.2 (which came from Georg's debian package)???


Filed under: gentoo linux pyds

Add a comment

Installed SilverCity for a pretty syntax highlighted blog.

I fould a Gentoo ebuild for SilverCity here but emerge-ing it just gave a weird error:

 Calculating dependencies \ !!! Problem with determining the name/location of an ebuild. !!! Please report this on IRC and bugs if you are not causing it. !!! mycpv:   /SilverCity !!! mysplit: '', 'SilverCity' !!! psplit:  None !!! error:   unsubscriptable object 

So I downloaded the tar file and used python install instead:

 tar xvfz SilverCity-0.9.5.tar.gz cd SilverCity-0.9.5 python setup.py install 

And as you can see..

print "This worked a treat"

I may be in trouble of Gentoo decides to upgrade python as SilverCity will not be updated automatically.

Installed SilverCity for a pretty syntax highlighted blog.

I fould a Gentoo ebuild for SilverCity here but emerge-ing it just gave a weird error:

 Calculating dependencies \ !!! Problem with determining the name/location of an ebuild. !!! Please report this on IRC and bugs if you are not causing it. !!! mycpv:   /SilverCity !!! mysplit: '', 'SilverCity' !!! psplit:  None !!! error:   unsubscriptable object 

So I downloaded the tar file and used python install instead:

 tar xvfz SilverCity-0.9.5.tar.gz cd SilverCity-0.9.5 python setup.py install 

And as you can see..

print "This worked a treat"

I may be in trouble of Gentoo decides to upgrade python as SilverCity will not be updated automatically.


Filed under: blog gentoo linux python

Add a comment

Building Gentoo packages does take a while, even for something simple you have to wait for .configure to run which takes a couple of minutes. To live with this I have learnt a couple of things.

First was the nohup command which works like this:

 nohup emerge huge-package & 

which will build the huge package and dump all the output to a file called nohup.out. This is useful for me if I build using a ssh shell which is likely to disconnect and cause the build to halt. With nohup I don't need to worry about that, the build is disconnected from the login shell.

Next is the at command:

 at 03:00 >>emerge huge-package <CTRL-D> 

This will emerge the huge package at 3am so it should be ready the next day. When the command finishes I get emailed the results. I tried using this last night to build a kernel but I typed:

 make bZImage 

instead of:

 make bzImage 

and it failed, so it'll have to wait for another night.


Filed under: gentoo linux ssh

Add a comment

Dixons in town were having a closing down sale so I had a browse. They had a Packard Bell system without monitor for just under £130. It is a couple of year old Athlon 1.7GHz thing with DVD/CDR, 256M and 40G hard disk. It was cheap because it had some kind of traumatic accident and the case was severly bent. They told me it worked and gave me a 6 month guarantee so I bought it.

I have put it's guts into the case of my old desktop pc so it is now more presentable.

Pros:

  • It feels much faster than my old system, and in fact any system i have used.

  • Hopefully it won't lock up randomly like the old one: this is what made me lose confidence in the old system and not want to use it.

  • It has freed up extra 128M memory and a CD/RW for my Gentoo box.

  • I can build a cheap system with the bits left over for my mum. I can set it to PIO mode so it won't crash and it'll still be faster than what she's got.

  • I have a spare Windows XP Home licence

  • I have a spare 80G hard disk to fix my sky plus box with

  • It's got a keyboard with lots of extra functions. I just found a function button where ctrl should be: function+left takes me to line start.

  • Nice mouse

  • Lots of software. Microsoft Zoo Tycoon!

Cons:

  • Not the most high tech motherboard I could have bought (MS 6511). Still, I found a reference for it on the internet easy enough.

  • Only 2 PCI slots: 1 after network card is put in. No ISA (rip).

  • Probably USB 1.1 from it's vintage. I have a USB 2 card to put in but then all the PCI slots are gone.

  • It starts up quite rapidly but it takes 30 seconds to shut down: very annoying when rebooting.

In a nutshell: I'm happy.

A footnote on why I use Windows and Gentoo. I think Windows is a good GUI and Linux is a good server. X apps are just not as slick as windows apps and setting up Windows server software is a nightmare of tree's and property pages (I'm talking Active Directory, Microsoft Exchange, ISS and ISA, I use them at work and I hate them all).


Add a comment

My broadband connection suddenly stopped working. This is NTL broadband for the record, using a DLink DI624 Wireless router. All PCs lost connection but could still connect to the router.

The problem turned out to be because the Router had lost the IP address allocated to it from the ISP via DHCP. I pressed the DHCP renew button on the status panel and it all burst into life. Not sure if it's a problem with my new XP setup, deciding to drop the DHCP for me.

I had to manually tell dyndns.org about my new IP address as I don't have my Gentoo box set up to do it. The router should be able to update it automatically but it crashes every time I try to set that up. Hum, maybe they have a new version of the firmware out...


Filed under: di624 gentoo linux ntl

2 Comments