Skip to content

Example app fails to run examples on Windows #2060

@NilsNemitz

Description

@NilsNemitz

When running the example application on Windows, examples run when clicking on the Run Example button.
However, trying to run an edited example, or starting an example by double clicking the name fails with

Traceback (most recent call last):
  File "C:\e\prog\pg_dev\pyqtgraph\pyqtgraph\examples\ExampleApp.py", line 485, in loadFile
    proc.stdin.write(code)
TypeError: a bytes-like object is required, not 'str'

Tested environment(s)

sys.platform: win32
sys.version: 3.9.7 | packaged by conda-forge | (default, Sep 14 2021, 01:11:01) [MSC v.1916 64 bit (AMD64)]
qt bindings: PyQt5 5.12.3 Qt 5.12.9
pyqtgraph: 0.12.3; None

Additional context

It seems this is the result of a change in #2045 :
In line 485 of exampleApp.py, the codeview text is now directly written to the stdin pipe. Previously UTF-8 encoding was specifically applied here. It seems this is still required, at least on (my specific version of) Windows.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions