Re: Boa app, full path to the running script ?

"Werner F. Bruhin" <[email protected]>
Newsgroups gmane.comp.ide.boa-constructor.user
Message-ID <[email protected]>
Hi,

aus stuff wrote:
> Hi,
> Within my boa app i cant seem to get my running apps path directory.
>  
> Using (within a frame/class)
> self.staticText1.SetLabel(os.path.split(sys.argv[0])[0])
> returns relative dir path (can i get absolute?)
>  
> sys.argv[0]
> will return the scripts name but not its directory path (from root of 
> drive , on windows)
>  
> Any other way to get the full path to your running app in boa apps on 
> windows?
Quote from Riaan on this some time ago:

mando wrote:
 > > os.getcwd() it's allright!
 > >
 > > My ultimate question is:  why the method  os.getcwd() run correctly 
with
 > > every IDE but this: directory, filename = 
os.path.split(sys.argv[0]) on Boa
 > > don't work? It's only a philosophic question!!!! Apologize me!

When Boa runs python scripts out of process, it changes to the directory
of the script and therefore only specifies the script name on the
command line generated to run the script.

I think this should work for all cases:

directory, filename = os.path.split(os.path.abspath(sys.argv[0]))

Best regards
Werner


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.