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

[Py3] Open background forks std{in,out,err} in binary mode #42

Closed
wants to merge 1 commit into from
Closed

[Py3] Open background forks std{in,out,err} in binary mode #42

wants to merge 1 commit into from

Conversation

MattHardcastle
Copy link

The following exception is thrown when running under Py3:

14:34:23 workflow.py:2542 INFO     Checking for update ...
14:34:23 workflow.py:2275 ERROR    can't have unbuffered text I/O
Traceback (most recent call last):
  File "/Volumes/Files/Private/Projects/bear-alfred-plugin/alfred-bear/workflow/workflow.py", line 2268, in run
    func(self)
  File "/Volumes/Files/Private/Projects/bear-alfred-plugin/alfred-bear/workflow/background.py", line 217, in main
    _background()
  File "/Volumes/Files/Private/Projects/bear-alfred-plugin/alfred-bear/workflow/background.py", line 132, in _background
    si = open(stdin, 'r', 0)
ValueError: can't have unbuffered text I/O

This change resolves the issue by switching the open from text to binary. Binary mode doesn't require a buffer so the exception isn't thrown.

This PR is part of a collection of changes to support Python3. The collection is broken into multiple stages. This change is part of stage 1 and should be safe to merge at any time.

re: #33

The following exception is thrown when running under Py3:

    14:34:23 workflow.py:2542 INFO     Checking for update ...
    14:34:23 workflow.py:2275 ERROR    can't have unbuffered text I/O
    Traceback (most recent call last):
      File "/Volumes/Files/Private/Projects/bear-alfred-plugin/alfred-bear/workflow/workflow.py", line 2268, in run
        func(self)
      File "/Volumes/Files/Private/Projects/bear-alfred-plugin/alfred-bear/workflow/background.py", line 217, in main
        _background()
      File "/Volumes/Files/Private/Projects/bear-alfred-plugin/alfred-bear/workflow/background.py", line 132, in _background
        si = open(stdin, 'r', 0)
    ValueError: can't have unbuffered text I/O

This change resolves the issue by switching the open from text to binary.
Binary mode doesn't require a buffer so the exception isn't thrown.

re: #33
@MattHardcastle MattHardcastle closed this by deleting the head repository Jul 7, 2024
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.

1 participant