-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Overriding sys.stdin causes errors in processes that actually uses attributes of sys.stdin #21
Comments
+1 for a default. I'm using rpdb to debug an OpenStack service which uses oslo.utils. oslo.utils has the following:
When this executes I see the following error:
The code runs fine outside rpdb because sys.stdin.encoding is defined. |
@dougszumski Well, that's exactly what I'm having now (also while debugging an OpenStack service). A workaround would be adding the I'm still waiting for a response from OP before submitting my PR. |
Yes that makes sense, I'll gladly review that PR. |
I'm not sure how this is happening since the point of @MarounMaroun are you using 0.1.6? @dougszumski could you check the type of |
@tamentis Yes, I'm on 0.1.6. |
@tamentis The solution should look something like this, can you please take a look? @dougszumski FYI. |
Here's a bit more info:
|
Ah, I think I see what's happening:
Looks like this happens in FileObjectWrapper:
|
@dougszumski good point. So the solution I suggested didn't work for you? |
Why was stdin\out assignment needed in the first place? I just commented them out and everything worked fine. |
@Boris-Barboris Which lines did you comment out? |
On commit 9c9d4f4 we added a wrapper to provide missing parameters (ie: `encoding`) in the object returned by `makefile`, unfortunately this didn't resolve all problems, as there are some cases, like in method oslo_utils.encodeutils.safe_decode where when accessing sys.stdin.encoding we would still get an error: AttributeError: "'_fileobject' object has no attribute 'encoding'" This patch fixes this issue and allows us to set the encoding when instantiating the Rpdb object. The way this has been fixed depends on the Python version: - For python 2 we extend _fileobject and add `errors` and `encoding` variables as well as the `isatty` method. - For python 3 we pass `encoding` to the `makefile` call and then create class attributes `errors` and `isatty` (since we cannot modify the instance itself).
Hi, everyone, is this problem solved? |
@airborne007 Not yet. The current solution is to add encoding attribute to |
In one of my projects I used
sys.stdin.encoding
, but since in this project we have:I got an exception during runtime.
Can we have a default values for that attribute (or even have the ability to pass its attribute in the constructor)?
(I can submit a PR if it's relevant)
The text was updated successfully, but these errors were encountered: