python path problems
#1
Hi,

there`s a problem with getting the current working directory while starting python scripts/plugins. Here's an quick example of what it looks like.

Code:
# main import's
import sys
import os

# Shared resources
BASE_RESOURCE_PATH = os.path.join( os.getcwd().replace( ";", "" ), "resources" )
sys.path.append( os.path.join( BASE_RESOURCE_PATH, "lib" ) )

print BASE_RESOURCE_PATH
print sys.path
Results in ..

Quote:1:32:37 T:2694835088 M:1137496064 DEBUG: Python thread: start processing
11:32:37 T:2694835088 M:1137496064 INFO: -->Python Interpreter Initialized<--
11:32:37 T:2694835088 M:1137496064 INFO:
11:32:37 T:2694835088 M:1137496064 INFO: /home/xbmc/XBMC/BUILD/resources
11:32:37 T:2694835088 M:1137496064 INFO:
11:32:37 T:2694835088 M:1137496064 INFO: ['/home/xbmc/XBMC/BUILD/scripts', '/usr/lib/python24.zip', '/usr/lib/python2.4/', '/usr/lib/python2.4/plat-linux2', '/usr/lib/python2.4/lib-tk', '/usr/lib/python2.4/lib-dynload', '/home/xbmc/XBMC/BUILD/resources/lib']
11:32:37 T:2694835088 M:1137496064 INFO:
11:32:37 T:2694835088 M:1137496064 INFO: Scriptresult: Succes
11:32:37 T:3071489952 M:1137496064 DEBUG: CGUIMediaWindow::GetDirectory (/home/xbmc/XBMC/BUILD/scripts/)

Due to this bug its impossible to run any python script or plugin within the Linux port of XBMC that make use of it (almost all).

Regards
VDRFan
Reply
#2
I can confirm this. a lot of python scripts are failing because of that. I believe the path that is returned is the build directory path (it must be hardcoded somewhere ).
Reply
#3
What is weird is that this is working with the version on the PPA ( 2.1a1p1 ) and not with the svn ...
Reply
#4
Could you let me know what revision is the 2.1a1p1? Maybe it could be fixed easily.
Reply
#5
it was based on SVN REV 12195
Reply
#6
I have tried with the latest SVN :

sys.path.append("lib")
print sys.path

and I get the right path.
Reply
#7
Hm. Appending "lib" to sys.path should result in "lib" Smile But ill test it asap.
Reply

Logout Mark Read Team Forum Stats Members Help
python path problems0