"""Loads and manages art assets"""
import pyglet

_ASSET_PATHS = ["res"]
_ASSET_FILE_NAMES = [
    "black_key_down.png",
    "black_key_up.png",
    "white_key_down.png",
    "white_key_up.png",
    "staff_line.png",
]

class Assets(object):

    _loadedAssets = None

    @staticmethod
    def loadAssets():
        Assets._loadedAssets = dict()
        Assets._updateResourcePath()
        for f in _ASSET_FILE_NAMES:
            Assets.loadAsset(f)

    @staticmethod
    def loadAsset(filename):
        Assets._loadedAssets[filename] = pyglet.resource.image(filename)

    @staticmethod
    def _updateResourcePath():
        for p in _ASSET_PATHS:
            pyglet.resource.path.append(p)
        pyglet.resource.reindex()

    @staticmethod
    def get(filename):
        if Assets._loadedAssets is None:
            raise RuntimeError("You must initialize the asset manager before "
                               "retrieving assets")
        return Assets._loadedAssets[filename]

"""Loads and manages art assets"""
import pyglet
import os

_ASSET_PATHS = ["res"]
_ASSET_FILE_NAMES = [
    "black_key_down.png",
    "black_key_up.png",
    "white_key_down.png",
    "white_key_up.png",
    "staff_line.png",
]

class Assets(object):

    _loadedAssets = None

    @staticmethod
    def loadAssets():
        Assets._loadedAssets = dict()
        Assets._updateResourcePath()
        for f in _ASSET_FILE_NAMES:
            Assets.loadAsset(f)

    @staticmethod
    def loadAsset(filename):
        Assets._loadedAssets[filename] = pyglet.resource.image(filename)

    @staticmethod
    def _updateResourcePath():
        for p in _ASSET_PATHS:
            pyglet.resource.path.append(os.path.join(os.getcwd(), p))
        pyglet.resource.reindex()

    @staticmethod
    def get(filename):
        if Assets._loadedAssets is None:
            raise RuntimeError("You must initialize the asset manager before "
                               "retrieving assets")
        return Assets._loadedAssets[filename]

Use absolute resource path in Pyglet
Use absolute resource path in Pyglet

It appears that a recent change in Pyglet causes relative paths to fail here.

  """Loads and manages art assets"""
  import pyglet
+ import os
  
  _ASSET_PATHS = ["res"]
  _ASSET_FILE_NAMES = [
      "black_key_down.png",
      "black_key_up.png",
      "white_key_down.png",
      "white_key_up.png",
      "staff_line.png",
  ]
  
  class Assets(object):
  
      _loadedAssets = None
  
      @staticmethod
      def loadAssets():
          Assets._loadedAssets = dict()
          Assets._updateResourcePath()
          for f in _ASSET_FILE_NAMES:
              Assets.loadAsset(f)
  
      @staticmethod
      def loadAsset(filename):
          Assets._loadedAssets[filename] = pyglet.resource.image(filename)
  
      @staticmethod
      def _updateResourcePath():
          for p in _ASSET_PATHS:
-             pyglet.resource.path.append(p)
+             pyglet.resource.path.append(os.path.join(os.getcwd(), p))
          pyglet.resource.reindex()
  
      @staticmethod
      def get(filename):
          if Assets._loadedAssets is None:
              raise RuntimeError("You must initialize the asset manager before "
                                 "retrieving assets")
          return Assets._loadedAssets[filename]
  
Use absolute resource path in Pyglet
## Code Before:
"""Loads and manages art assets"""
import pyglet

_ASSET_PATHS = ["res"]
_ASSET_FILE_NAMES = [
    "black_key_down.png",
    "black_key_up.png",
    "white_key_down.png",
    "white_key_up.png",
    "staff_line.png",
]

class Assets(object):

    _loadedAssets = None

    @staticmethod
    def loadAssets():
        Assets._loadedAssets = dict()
        Assets._updateResourcePath()
        for f in _ASSET_FILE_NAMES:
            Assets.loadAsset(f)

    @staticmethod
    def loadAsset(filename):
        Assets._loadedAssets[filename] = pyglet.resource.image(filename)

    @staticmethod
    def _updateResourcePath():
        for p in _ASSET_PATHS:
            pyglet.resource.path.append(p)
        pyglet.resource.reindex()

    @staticmethod
    def get(filename):
        if Assets._loadedAssets is None:
            raise RuntimeError("You must initialize the asset manager before "
                               "retrieving assets")
        return Assets._loadedAssets[filename]

## Instruction:
Use absolute resource path in Pyglet
## Code After:
"""Loads and manages art assets"""
import pyglet
import os

_ASSET_PATHS = ["res"]
_ASSET_FILE_NAMES = [
    "black_key_down.png",
    "black_key_up.png",
    "white_key_down.png",
    "white_key_up.png",
    "staff_line.png",
]

class Assets(object):

    _loadedAssets = None

    @staticmethod
    def loadAssets():
        Assets._loadedAssets = dict()
        Assets._updateResourcePath()
        for f in _ASSET_FILE_NAMES:
            Assets.loadAsset(f)

    @staticmethod
    def loadAsset(filename):
        Assets._loadedAssets[filename] = pyglet.resource.image(filename)

    @staticmethod
    def _updateResourcePath():
        for p in _ASSET_PATHS:
            pyglet.resource.path.append(os.path.join(os.getcwd(), p))
        pyglet.resource.reindex()

    @staticmethod
    def get(filename):
        if Assets._loadedAssets is None:
            raise RuntimeError("You must initialize the asset manager before "
                               "retrieving assets")
        return Assets._loadedAssets[filename]
