-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Execution fails if standard streams are not available #5212
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
Comments
Thanks for the report. I've always thought that I'll assign this initially to RF 7.2 scope. If fixing this properly is easy, we can cherrypick the fix to RF 7.1 maintenance branch as well to get it included in RF 7.1.1. |
I looked at the code base and there were several places where we write to output streams without looking are they sys.stdout = sys.stderr = sys.__stdout__ = sys.__stderr__ = None to an imported listener and that broke
Fixing the above error would be easy, but when added the above code disabling streams to Robot's own code, the whole execution broke and fixing that would be a lot more complicated. Do you have a simple example with pyinstaller that I could use to reproduce the exact problem you got? I doubt that problem is as severe as the second problem I mentioned above. Do you have a simple example using pyinstaller that I could use to reproduce the problem? |
spec file
Pyinstall can have problems finding dependencies and needs to be manually specified when it does not automatically find them |
Could you update the spec file to contain needed imports and also provides instructions how to use it? Notice that I don't have any experience from using pyinstaller. |
@miaopass-future there is a marketsquare repo dealing with the distribution of robotframework as a single file (zipapps). pyinstaller is a different solution to a similar problem. I would love to have a description how to do robot distribution using pyinstaller on marketsquare, in a tested way. You could make your own repo, create a pull request to this one https://github.com/MarketSquare/compact_testprogram_distribution, or share a minimal example and I can integrate it there... |
Setting up PyInstaller when I have zero experience with it looked a bit complicated. I decided to instead go through places where we write to |
This can happen if Robot is executed using pythonw.exe or is embedded using, for example, PyInstaller. Fixes #5212.
There's a problem with the way I describe it, and it's not about marketsquare, it's about sys. And Sys.. None when possible |
@miaopass-future there is no problem with the way you describe the problem. This part is good. I would like to know how to build a robotframework pyinstaller. if you can provide me with an example, that would be highly appreciated. |
@miaopass-future, the Marketsquare is a place where the Robot Framework community can share projects, examples, etc. @franzhaas has set up a repository there for standalone Robot distributions and it already contains his zippapp based example. Having another example using PyInstaller there would be great. |
Uh oh!
There was an error while loading. Please reload this page.
My Python programs rely on the robot framework, and when I package and run them using a wrapper like pyinstaller, an error is reported here if the packaging parameter console is set to False
robot\running\outputcapture.py 47L
def _release_and_log(self): stdout, stderr = self._release() if stdout: LOGGER.log_output(stdout) if stderr: LOGGER.log_output(stderr) sys.__stderr__.write(console_encode(stderr, stream=sys.__stderr__))
The error message is
sys.__stderr__.write(console_encode(stderr, stream=sys.stderr)) AttributeError: 'NoneType' object has no attribute 'write'
The text was updated successfully, but these errors were encountered: