I would use os.path.abspath() to see if the path you think you are passing is what is actually being passed.
e.g.,
import os, pygame
p = os.path.abspath("../images/image.png")
print p
pygame.image.load(p)
--p
On Mon, Jul 14, 2008 at 9:23 AM, Dan Krol <
orblivion@xxxxxxxxx <mailto:
orblivion@xxxxxxxxx>> wrote:
Lets say you have:
/home/user/project/
/home/user/project/images
/home/user/project/scriptst/game.py
You say:
cd /home/user/project/
python scripts/game.py
You would want your images referenced as "images/image.png"
If however, you say:
cd /home/user/project/scripts
python game.py
You would want your images referenced as "../images/image.png"
In other words, your image path is relative to where you cd to, not
where game.py is.
On Mon, Jul 14, 2008 at 11:19 AM, Olaf Nowacki <
ioa@xxxxxxx
<mailto:voights@xxxxxxxxx>>:
>>
>> Yes, but the path is relative to where you are running the script
>> from, not where the script is.
>>
>> On Mon, Jul 14, 2008 at 11:43 AM, Olaf Nowacki <
ioa@xxxxxxx
<mailto:
ioa@xxxxxxx>> wrote:
>> > hi everyone,
>> > is it possible to load an image with pygame.image.load() that
is not in
>> > the
>> > same folder (or a subfolder), but higher up in the file-tree?
i tried
>> > giving
>> > "../data/images/image.png" as argument, but it didn't work.
>> > here i tried to illustrate what i mean:
>> > [game]
>> > |- [engine]
>> > |- tools.load_image()
>> > |- [data]
>> > |-[images]
>> > |- image.png
>> > thanks in advance!
>> > olaf
>> >
>
>
>
> --
> Olaf Nowacki
> Schandauer Straße 8
> 12045 Berlin
>
> 0178 - 688 38 05