← Back to team overview

openshot.developers team mailing list archive

Re: Working around Python bug with __file__

 

Hello TJ
Not for the moment, you know that i'am very busy, but if you have to loose
some time , one day (in one or two months), could you explain me how do you
debugg a program python ? and how create a patch too ? Of course, if i can .
Life is a long road and the knowledges too.
Thanks, Olivier

2009/8/29 TJ <ubuntu@xxxxxxxxxxx>

> A fix for the problem I discovered using Python debugger Pdb.
>
> In some circumstances Python will not define __file__ to be an absolute
> path of the script currently executing, including when the debugger is
> responsible for starting the application.
>
> E.g. it should be "/usr/share/openshot/openshot.py" but reports
> "openshot/openshot.py"
>
> If it is a relative path it will cause operations such as:
>
> os.path.dirname(__file__)
>
> to return an empty string or an incorrect result.
>
> The solution is to wrap __file__ to get the absolute path first:
>
> os.path.dirname(os.path.abspath(__file_))
>
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~openshot.developers<https://launchpad.net/%7Eopenshot.developers>
> Post to     : openshot.developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~openshot.developers<https://launchpad.net/%7Eopenshot.developers>
> More help   : https://help.launchpad.net/ListHelp
>



-- 
Cenwen un elfe sur la banquise

References