Skip to content
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

fix: stdio problem when making exe using pyinstaller with noconsole flag #198

Merged
merged 2 commits into from
May 28, 2021

Conversation

HHongSeungWoo
Copy link
Contributor

No description provided.

@pep8speaks
Copy link

Hello @HHongSeungWoo! Thanks for opening this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 151:80: E501 line too long (107 > 79 characters)
Line 171:80: E501 line too long (107 > 79 characters)

@SergeyPirogov
Copy link
Owner

@HHongSeungWoo what problem we are solving by this?

@codecov-commenter
Copy link

codecov-commenter commented May 27, 2021

Codecov Report

Merging #198 (5cd860d) into master (4169000) will increase coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #198      +/-   ##
==========================================
+ Coverage   88.49%   88.52%   +0.02%     
==========================================
  Files          11       11              
  Lines         452      453       +1     
  Branches       48       48              
==========================================
+ Hits          400      401       +1     
  Misses         35       35              
  Partials       17       17              
Impacted Files Coverage Δ
webdriver_manager/utils.py 74.07% <100.00%> (+0.24%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4169000...5cd860d. Read the comment docs.

@HHongSeungWoo
Copy link
Contributor Author

HHongSeungWoo commented May 27, 2021

@SergeyPirogov
Test OS: windows, linux

In browser version check function, to get a version, this library uses os.popen.
os.popen uses subprocess.popen with stdin=None, and stderr=None.
But, If std* is set to None, subprocess.popen try to find std* from parents.
When using pyinstaller with --no-console in windows, parents do not have std*. So, It cause freezing.
pyinstaller source code

So, I replaced os.popen with subprocess.popen and set stderr and stdin to subprocess.DVENULL.

@rockyhuber
Copy link

Any idea how to make the console disappear? The original console is hidden, though now with these changes it opens another console. I have tried hundreds of variations to try to make it work, best I have been able to do is make the console disappear around 5s after.

cmd = cmd_mapping[browser_type][os_name()] version = None with subprocess.Popen(cmd, shell=False, creationflags=0x00000008, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, stdin=subprocess.DEVNULL) as stream: stdout = stream.communicate()[0].decode() version = re.search(pattern, stdout)

@HHongSeungWoo
Copy link
Contributor Author

@rockyhuber i dont speak english well, but if you want hide consloe, try using creationflags=0x08000000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants