Reputation: 4017
I've been using the following code for a while:
import ctypes
me = ctypes.CDLL(None)
me.prctl(15, "meow", 0, 0, 0)
With Python-2.6 on RHEL6 this works, changing process name to "meow".
With Python-3.7 on RHEL7, however, after going through same code, the process name becomes "m" -- just the first letter of the string.
What's going on?
Upvotes: 1
Views: 250
Reputation: 54733
The ctypes prctl
is probably expecting 8-bit strings, and in Python 3 you're now passing Unicode. Try me.prctl(15, b"meow", 0, 0, 0)
.
Upvotes: 3