hey all,
i know this might be a dull question, but i dont get it...
this works in python2
wbr
chris
i know this might be a dull question, but i dont get it...
this works in python2
#!/usr/bin/env python import subprocess proclist = subprocess.check_output(['ps', 'uaxw']).splitlines() cfeagent_procs = [proc for proc in proclist if 'cf-agent' in proc] cfeagent_count = len(cfeagent_procs) print(cfeagent_count) if cfeagent_count > 10: print("agents high")
Output:root@aixhemadbprc2: /root # ./process_count.py
145
agents high
but not in python3Error:root@aixhemadbprc2: /root # ./process_count.py
Traceback (most recent call last):
File "./process_count.py", line 6, in <module>
cfeagent_procs = [proc for proc in proclist if 'cf-agent' in proc]
File "./process_count.py", line 6, in <listcomp>
cfeagent_procs = [proc for proc in proclist if 'cf-agent' in proc]
TypeError: a bytes-like object is required, not 'str'
sorry i need a hint...wbr
chris
Larz60+ write Jul-09-2021, 05:17 PM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Fixed for you this time. Please use bbcode tags on future posts.
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Fixed for you this time. Please use bbcode tags on future posts.