indygreg / indygreg/PyOxidizer
pyglet from venv problem with __file__
- Dominant language
- Rust
- Stars
- 6.2k
- Forks
- 256
- PR merge metrics
- No merged PRs in 30d
Description
## Test script (from https://pyglet.readthedocs.io/en/latest/programming_guide/quickstart.html)
## script (__main__.py in helper module)
```
import pyglet
window = pyglet.window.Window()
image = pyglet.resource.image('kitten.png')
@window.event
def on_draw():
window.clear()
image.blit(0, 0)
pyglet.app.run()
```
## Error output
```
Traceback (most recent call last):
File "pyglet", line 353, in __getattr__
AttributeError: 'NoneType' object has no attribute 'Window'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "pyglet", line 353, in __getattr__
AttributeError: 'NoneType' object has no attribute 'get_default'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "pyglet", line 353, in __getattr__
AttributeError: 'NoneType' object has no attribute 'get_script_home'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "helper.__main__", line 3, in
File "pyglet", line 359, in __getattr__
File "pyglet.window", line 1877, in
File "pyglet.window.win32", line 60, in
File "pyglet.canvas", line 64, in
File "pyglet.app", line 165, in
File "pyglet.app.base", line 152, in __init__
File "pyglet", line 359, in __getattr__
File "pyglet.clock", line 125, in
File "pyglet.lib", line 60, in
File "pyglet", line 359, in __getattr__
File "pyglet.resource", line 798, in
File "pyglet.resource", line 329, in __init__
File "pyglet.resource", line 145, in get_script_home
File "ntpath", line 526, in abspath
TypeError: _getfullpathname: path should be string, bytes or os.PathLike, not NoneType
SystemError
error: cargo run failed
```
## NOTES:
- this seems connected to calls like `path = os.path.dirname(os.path.abspath(main.__file__))`
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the quickstart script in __main__.py through the reported venv and cargo run path, then trace the __file__ handling around os.path.abspath and pyglet.resource.get_script_home. Done means the script can create its window and load kitten.png without the NoneType path error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, rust
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100