Traceback (most recent call last):
File "yep.py", line 23, in <module>
File "pyglet/resource.py", line 529, in image
File "pyglet/resource.py", line 458, in _alloc_image
File "pyglet/resource.py", line 414, in file
pyglet.resource.ResourceNotFoundException: Resource "ad.jpg" was not found on the path. Ensure that the filename has the correct captialisation.
You're probably not including the resource directory in the resulting bundle:
datas = [
('resources', 'resources')
]
HTH,
--
You received this message because you are subscribed to the Google Groups "pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyglet-users...@googlegroups.com.
To post to this group, send email to pyglet...@googlegroups.com.
Visit this group at https://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.
import sys
import os
box = pyglet.image.load(resource_path('picture.png'))
def resource_path(relative_path):
""" Get absolute path to resource, works for dev and for PyInstaller """
if hasattr(sys, '_MEIPASS'):
return os.path.join(sys._MEIPASS, relative_path)
return os.path.join(os.path.abspath("."), relative_path)
added_files = [ ('beats', 'beats'), ('imgs', 'imgs') ] a = Analysis(['yep.py'], pathex = ['/Users/mitchellbarton/workspace/freestylez'], binaries = None, datas = added_files, )
import os, sys, pyglet
from random import shuffle
from random import randint
import subprocess
# basic app info
if getattr( sys, 'frozen', False ) :
# running in a bundle
print('bundle')
else :
# running live
print('live')
pyglet.options['audio'] = ('openal', 'silent')
window = pyglet.window.Window(width=400, height=500)
window.activate()
window.set_caption('F R E E S T Y L E Z ( B A T T L E )')
print('worked')
pic1 = pyglet.resource.image('imgs/ad.jpg')
pic2 = pyglet.resource.image('imgs/ad-2.jpg')
pic3 = pyglet.resource.image('imgs/ad-3.jpg')
pic4 = pyglet.resource.image('imgs/ad-4.jpg')
pic5 = pyglet.resource.image('imgs/ad-5.jpg')
picz = [pic1, pic2, pic3, pic4, pic5]
shuffle(picz)
--
You received this message because you are subscribed to a topic in the Google Groups "pyglet-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pyglet-users/q8diddF_uU8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pyglet-users...@googlegroups.com.
# add a folder to the resource path
pyglet.resource.path.append("imgs")
pyglet.resource.reindex()
pic = pyglet.resource.image("ad.jpg")
def resource_path(relative_path):
#Get absolute path to resource, works for dev and for PyInstaller
if hasattr(sys, '_MEIPASS'):
return os.path.join(sys._MEIPASS, relative_path)
return os.path.join(os.path.abspath("."), relative_path)
pic1 = pyglet.image.load(resource_path('imgs/ad.jpg'))
pic2 = pyglet.image.load(resource_path('imgs/ad-2.jpg'))
pic3 = pyglet.image.load(resource_path('imgs/ad-3.jpg'))
pic4 = pyglet.image.load(resource_path('imgs/ad-4.jpg'))
pic5 = pyglet.image.load(resource_path('imgs/ad-5.jpg'))
File "site-packages/pyglet/image/__init__.py", line 178, in load
FileNotFoundError: [Errno 2] No such file or directory: '/var/folders/cy/wd4tdsz11b3g4sq7m6q47sz40000gr/T/_MEIYB5FHD/imgs/ad.jpg'
pic1 = pyglet.image.load(resource_path('ad.jpg'))
myzipfile = zipfile.ZipFile(resource_path('data.zip'),'r')
for fileName in myzipfile.namelist():
if fileName == 'picture.PNG':
myzipfile.extract(fileName,resource_path(''))
self.image = pyglet.image.load(resource_path(fileName))
os.remove(resource_path(fileName))
added_files = [
('beats', 'beats'),
('imgs', 'imgs')
]
a = Analysis(['yep.py'],
pathex=['/Users/mitchell/Workspace/freestylez'],
binaries=None,
datas=added_files
)