Atanas Banov wrote:
> Bryan Olson wrote:
>
>>To get it with the \, you might use:
>>
>> os.path.abspath(os.environ['SYSTEMDRIVE'])
>
>
> wrong!
> the result is incorrect if the current directory is different from the
> root.
Oops, sorry. I should know better than to code from what I
think I
Bryan Olson wrote:
> To get it with the \, you might use:
>
> os.path.abspath(os.environ['SYSTEMDRIVE'])
wrong!
the result is incorrect if the current directory is different from the
root.
>>> os.chdir("c:\\winxp")
>>> os.path.abspath(os.environ['SYSTEMDRIVE'])
'c:\\winxp'
if you really wan
rtilley wrote:
> Carsten Haese wrote:
>
>> Is there a reason why os.environ['SYSTEMDRIVE'] shouldn't work?
>
> I didn't know it was in os! It returns C: instead of C:\ like my method.
> Other than that, it seems to do the trick.
To get it with the \, you might use:
os.path.abspath(os.envi
Atanas Banov wrote:
> using
>os.chdir('/')
>os.getcwd()
> is plain wrong in Windows.
>
> what it does is change the current directory to root of the CURRENT
> DRIVE (i.e. the drive of the directory where script was started from),
> not the system drive. for example, if current directory wa
using
os.chdir('/')
os.getcwd()
is plain wrong in Windows.
what it does is change the current directory to root of the CURRENT
DRIVE (i.e. the drive of the directory where script was started from),
not the system drive. for example, if current directory was
c:\myscripts and system drive is d
Another hack:
drive = os.popen("echo %SYSTEMDRIVE%").readline().strip()
rtilley wrote:
> Is there a proper way to get this variable from Windows? I know it's in
> the registry, but I'd rather not go there. I could not find a CSIDL
> shell constant for it either. I've been doing this:
>
> os.chdi
Carsten Haese wrote:
> Is there a reason why os.environ['SYSTEMDRIVE'] shouldn't work?
>
> Hope this helps
I didn't know it was in os! It returns C: instead of C:\ like my method.
Other than that, it seems to do the trick.
Thank you!
Brad
--
http://mail.python.org/mailman/listinfo/python-lis
On Wed, 2006-02-15 at 14:07, Todd Whiteman wrote:
> Another hack:
> drive = os.popen("echo %SYSTEMDRIVE%").readline().strip()
>
> rtilley wrote:
> > Is there a proper way to get this variable from Windows? I know it's in
> > the registry, but I'd rather not go there. I could not find a CSIDL
> >