question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

python3: Exception if there is any output on std_err

See original GitHub issue

Testscript:

#!/usr/bin/env python3

import winrm

s = winrm.Session('127.0.0.1:55985', auth=('vagrant', 'vagrant'))
s.run_ps('asfasf')

Result:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/alvaro/.local/lib/python3.5/site-packages/winrm/__init__.py", line 54, in run_ps
    rs.std_err = self._clean_error_msg(rs.std_err)
  File "/home/alvaro/.local/lib/python3.5/site-packages/winrm/__init__.py", line 62, in _clean_error_msg
    if msg.startswith("#< CLIXML\r\n"):
TypeError: startswith first arg must be bytes or a tuple of bytes, not str

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:5
  • Comments:5

github_iconTop GitHub Comments

4reactions
alvaroalemancommented, Sep 24, 2016

@nitzmahone: I think this is a pretty serious issue as it prevents any error handling when run under Python 3. Any chance a fix for this will get done in a timely manner?

2reactions
JPvRielcommented, Feb 7, 2017

duplicate of #111

Read more comments on GitHub >

github_iconTop Results From Across the Web

Does Python traceback.print_exc() prints to stdout or stderr?
According to the python documentation states "If file is omitted or None, the output goes to sys.stderr; otherwise it should be an open...
Read more >
8. Errors and Exceptions — Python 3.11.1 documentation
If an exception occurs which does not match the exception named in the except clause, it is passed on to outer try statements;...
Read more >
How to print to stderr and stdout in Python? - GeeksforGeeks
In Python, whenever we use print() the text is written to Python's sys.stdout, whenever input() is used, it comes from sys.stdin, ...
Read more >
Capturing stderr and exceptions from python in org-mode
I defined a function that temporarily redirects the output to stdout and stderr, so they can be captured. I execute the code wrapped...
Read more >
Understanding the Python Traceback
Python prints a traceback when an exception is raised in your code. The traceback output can be a bit overwhelming if you're seeing...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found