* newton10471:
Hi,

I'm trying to use subprocess.Popen() to do a Linux chroot to a mount
point passed in as a parameter to the following function:

def getInstalledKernelVersion(mountPoint):
    linuxFsRoot = mountPoint + "/root"
    print "type of linuxFsRoot is %s" % type(linuxFsRoot)
    installedKernelVersionResult =
subprocess.Popen(['chroot',linuxFsRoot,'rpm','-q','kernel-xen'])
    return installedKernelVersionResult

and it dies with the following:

type of linuxFsRoot is <type 'str'>
chroot: cannot change root directory to /storage/mounts/
mnt_3786314034939740895.mnt/root: No such file or directory

When I explicitly set linuxFsRoot = "/storage/mounts/
mnt_3786314034939740895.mnt/root", it works fine.

I also tried this to concatenate the mountpoint + /root, and it failed
in the same way:

linuxFsRoot = ("%s/root") % mountPoint

Use the os.path functions.


Anyone know what might be happening here?

Since the computed and literal paths /look/ identical and same type, the only thing I can imagine is that there is some invisible character. Try comparing the computed and literal path character by character. Print the difference or if they're identical, that they are.

Possibly you have GIGO problem.


Cheers & hth.,

- Alf
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to