Environment vars
#1
A little question: i know how to modify the environment vars using os.environ, but i need to modify PYTHONPATH to add a modules directory for PySH and xTerm and doing it with python is of nosense since PYTHONPATH must be changed before python is launched to get it working (i have spend two days using os.environ until i learn this), so where is stored XBMC system environments so i can modify them using and install script? I want to put the library and apps modules inside a lib/ and bin/ directories because have all the python scripts at the XUT root dir seems very ugly and not profesional...

It's strange: i was getting surprised with python because it's the only one language that has let me program in my very own crazy personal style, and now i get problems with something so simple and stupid as import a script from outside the default modules directory...No
Reply
#2
pyconfig.h

Can't you just put them in q:\\system\\python
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#3
Nuka1195 Wrote:pyconfig.h

Uh-oh... hardcoded? No AdvanceSettings rules or similar? No

Nuka1195 Wrote:Can't you just put them in q:\\system\\python

I tried it but didn't work, i'll try it again to see if it now workd, now thant i know what was the problem. but i'm really surprised about this Python limitation...Eek
Reply
#4
maybe I don't understand, but sys.path.append() modifies the pythonpath
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#5
Nuka1195 Wrote:maybe I don't understand, but sys.path.append() modifies the pythonpath

Maybe it works... The problem that i've found is that python check the PYTHONPATH var at begin as a system process that is (in XBMC is a thead, i know), but althought you modify it and launch a lot os scripts, they are running inside the same python process, so PYTHONPATH is not reloaded... and new python dirs are no taken. At PC i have been able to solve adding that to autoexec.bat (i'm using still Windows 98...), but on XBMC i don't know how to repair that but retry to use "Q:\system\python\Lib"...

What about to have a file for system vars parsed at boot time instead have them hardcorded in the code? It would be usefull for other parts... Or maybe add an entry on AdvanceSettings.xml and use them...

P.D.: call me dumb, but i didn't found pyconfig.h on SVN repository (http://xbmc.svn.sourceforge.net/viewvc/x...bmcmodule/) or Google...No
Reply
#6
This afternoon i was seeing inside the T3ch standard python scripts (Snake, Apple Trailers, Tetris...), and what is that i found? All them have some kind of lib/ folder!!!!

It seems the magic is to use sys.path.append(your_dir) as i have confirmed on Google, so it's appened to the PYTHONPATH and this is really used, so you can have all your files in a nice way inside your app. This should be on the wiki, and now i'm going to put it. Too many days lost by something so simple...
Reply
#7
I thought I said that a few days ago. Smile
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#8
Nuka1195 Wrote:I thought I said that a few days ago. Smile

Uops... it's true Tongue I understand then that append only added to the end of the PYTHONPATH var in the same way i was doing coding it by hand... Big Grin Well, at least now it works and not only i have a very cute unix dir tree inside XUT app althought now i can open a shell inside the shell!!!Nod The only problem is that os.getcwd is common to both, but storing it at begin of the new shell solve it Smile

There is someone with enough python and unix skills to help me extend that little monster?Rolleyes
Reply

Logout Mark Read Team Forum Stats Members Help
Environment vars0