-
Type:
Bug
-
Resolution: resolved
-
Priority:
Major
-
Component/s: None
-
None
https://github.com/slaclab/rogue/issues/1120
Creating a rogue environment as described [here](https://slaclab.github.io/rogue/installing/miniforge.html#creating-a-rogue-environment) installs python version 3.12. Attempted to start a GUI with something like `python -m pyrogue gui --server='localhost:9099'` but got error
```
File "/home/user/micromamba/envs/rogue/lib/python3.12/site-packages/pyrogue/pydm/widgets/time_plotter.py", line 651, in LegendRow
main: "TimePlotter" | None = None,
~~~~~~~~~~~~~^~~~~
TypeError: unsupported operand type(s) for |: 'str' and 'NoneType'
```
Evidently `"TimePlotter"` is not interpreted as the type, but simply as a string. This appears to no longer be a problem starting with python version 3.14. Further, it seems that in versions < 3.14 the problem only occurs when a type name as a string in the type hint is used in conjunction with the `|` syntax.
Minimal example I checked with python version 3.12, 3.13 and 3.14:
```py
class SomeType:
pass
- Does not correctly interpret quoted string as the type
def f(a: "SomeType" | int = None):
print(a)
- Type name without quotes works fine
def g(a: SomeType | int = None):
print(a)
- With quotes but no | works as well
def h(a: "SomeType" = None):
print(a)
```
Error occurs with version 3.12 (and 3.13) but not with 3.14.
Problematic code appears to have been added recently in 390f586 by @bengineerd .
It appears that `time_plotter.py`, line 651 might be the only occurence where this is a problem, but I did not check the files thoroughly. At least removing the quotes for me resolved the issue.