ExecutionEnvironment.getEnvironmentVariable bug?

I am running into an strange error.

:loader(error): Couldn't load file E:\projects\PythonArenaServer\graphics\arena2.egg: not found on model path (currently: "/e/projectsPythonArenaServer;/c/Panda3D-1.8.0/etc/..;/c/Panda3D-1.8.0/etc../models")
Traceback (most recent call last):
  File "main.py", line 63, in <module>
    ConnectionAcceptManager(6666, 2)
  File "main.py", line 33, in __init__
    self.scenario = Scenario()
  File "E:\projects\Arena\scenario.py", line 118, in __init__
    self.environ = loader.loadModel(mydir + "\\graphics\\arena2.egg")
  File "C:\Panda3D-1.8.0\direct\showbase\Loader.py", line 170, in loadModel
    raise IOError, message
IOError: Could not load model file(s): ['E:\\projects\\PythonArenaServer\\graphics\\arena2.egg']

The problem is that the model exists in this path. If I try to list it, it is there.

mydir has the return of ExecutionEnvironment.getEnvironmentVariable(“MAIN_DIR”)

Any ideas?


Solved the problem by using this code:

	ld = ExecutionEnvironment.getEnvironmentVariable("MAIN_DIR")
	if (ld[0] in string.uppercase):
		newLd = "/"
		newLd += ld[0].lower()
		newLd += ld[2:].replace("\\", "/")
		return newLd
	return ld

Still I am wondering why the getEnvironmentViriable is not working, it used to work in the past…

You are trying to load a Windows-style filename. You must instead convert it to a Panda-style filename. Your by-hand code (mostly) does this, but it’s easier and better to use:

newFilename = Filename.fromOsSpecific(oldFilename)