osdir.com

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Issue in using "subprocess.Popen" for parsing the command output


Dear Karsten,

With the help of Mrab Inputs, I tried Even with  "return
stdout.strip().decode("utf-8")", it still seems to be an issue, I am using
python 3.6, is this causing a issue?

/home/srinivasan/Downloads/wifidisconnectissuenov23_homework/venv/bin/python
/home/srinivasan/Downloads/wifidisconnectissuenov23_homework/qa/test_library/test4.py
printing stdout!!!!!!!!!!
printing retcode!!!!!!!!!! 0
Traceback (most recent call last):
  File
"/home/srinivasan/Downloads/wifidisconnectissuenov23_homework/qa/test_library/test4.py",
line 37, in <module>
    main("Apartment 18", "40672958689850014685")
  File
"/home/srinivasan/Downloads/wifidisconnectissuenov23_homework/qa/test_library/test4.py",
line 34, in main
    return stdout.strip().decode("utf-8")
AttributeError: 'str' object has no attribute 'decode'

Process finished with exit code 1

Many Thanks in advance

On Sun, Nov 25, 2018 at 11:57 PM Karsten Hilbert <Karsten.Hilbert at gmx.net>
wrote:

> > Even only with "*proc.decode("utf-8")"* in the above code still it seems
> to
> > throw the error
>
> No it does not. It throws the same TYPE of error due to the same
> SORT of mistake you made.
>
> You need to read carefully and try to think about what you read.
>
> Karsten
> --
> https://mail.python.org/mailman/listinfo/python-list
>