Skip to content

doc/tutorial/helloworld.rst - __file__ is not defined when setting up RESOURCES #287

Description

@rrpegasus

What doesn't work?

  1. Resources is now under examples
  2. NameError: name '__file__' is not defined
    when running
    RESOURCES = sdl2.ext.Resources(__file__,"examples/resources")

How To Reproduce

import sys
import sdl2
import sdl2.ext
RESOURCES = sdl2.ext.Resources(__file__,"examples/resources")

Platform (if relevant):

  • OS: Win11 amd64
  • Python Version: 3.12.10
  • SDL2 Version: 0.9.17
  • Using pysdl2-dll: Yes

Additional context
Fix

RESOURCES = sdl2.ext.Resources(sdl2.__file__,"examples/resources")
RESOURCES.get_path("hello.bmp")
'C:\\Users\\jdoe\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.12_abc123def456g\\LocalCache\\local-packages\\Python312\\site-packages\\sdl2\\examples\\resources\\hello.bmp'

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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