Tue 08 Jun 2004

  • python: In python, os.path.join has a somewhat unexpected behavior. For example:

    os.path.join (‘/tmp’, ‘foo’) => ‘/tmp/foo’

    os.path.join (‘/tmp’, ‘/foo’) => ‘/foo’

    Consider the following example code:

    os.system (‘rm -rf ‘ + os.path.join (chroot_path, ‘/dev’))

    Eek.

  • python (update): A better way to do this is to do:

    os.path.normpath (chroot_path + os.path.sep + subpath)

Leave a Reply

Your email address will not be published. Required fields are marked *