[Baypiggies] TypeError in os.path.realpath
Shannon -jj Behrens
jjinux at gmail.com
Wed May 30 22:42:31 CEST 2012
print "The original whatever was %r" % whatever_piece_of_data
If you need to, hack posixpath.py itself.
On Wed, May 30, 2012 at 9:33 AM, Lincoln Peters <anfrind at gmail.com> wrote:
> I'm developing a Python tool to monitor some of our Linux servers (running
> RHEL 5.6 and Python 2.4). In some cases, I need to track down the
> executable file for a running process, which I should be able to by
> resolving the symlink at /proc/<PID>/cmd. When I use the "readlink"
> command at the shell, it works correctly, but sometimes when I call
> os.path.realpath with the exact same path, I get a TypeError the following
> traceback (note: copied by hand since the servers have no Internet access):
> File "/usr/lib64/python2.4/posixpath.py", line 423, in realpath
> resolved = _resolve_link(component)
> File "/usr/lib64/python2.4/posixpath.py", line 440, in _resolve_link
> while islink(path):
> File "/usr/lib64/python2.4/posixpath.py", line 159, in islink
> st = os.lstat(path)
> TypeError: lstat() argument 1 must be (encoded string without NULL bytes),
> not str
> Strangely, this only happens with some processes and not others, and I
> can't discern any pattern. Any thoughts?
> Thanks in advance.
> Baypiggies mailing list
> Baypiggies at python.org
> To change your subscription options or unsubscribe:
In this life we cannot do great things. We can only do small things with
great love. -- Mother Teresa
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Baypiggies