getting 'pwd' for XP ?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

getting 'pwd' for XP ?

dave s-6
I currently running XP (like a fish out of water :) and I need to know the dir
that the python script is executed from. a linux 'pwd' How can I achieve
this - I have looked in sys & os & os.path but found nothing suitable

Dave
_______________________________________________
Tutor maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/tutor
Reply | Threaded
Open this post in threaded view
|

Re: getting 'pwd' for XP ?

David Rock
* Dave S <[hidden email]> [2006-09-28 16:10]:
> I currently running XP (like a fish out of water :) and I need to know the dir
> that the python script is executed from. a linux 'pwd' How can I achieve
> this - I have looked in sys & os & os.path but found nothing suitable

os.getcwd()
http://docs.python.org/lib/os-file-dir.html

--
David Rock
[hidden email]
_______________________________________________
Tutor maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/tutor
Reply | Threaded
Open this post in threaded view
|

Re: getting 'pwd' for XP ?

शंतनू
In reply to this post by dave s-6
+++ Dave S [28-09-06 16:10 +0100]:
| I currently running XP (like a fish out of water :) and I need to know the dir
| that the python script is executed from. a linux 'pwd' How can I achieve
| this - I have looked in sys & os & os.path but found nothing suitable

====================
Python 2.4.3 (#2, Sep 26 2006, 15:27:42)
[GCC 3.4.4 [FreeBSD] 20050518] on freebsd6
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.getcwd()
'/tmp'
>>>  
====================

--
An idea that is not dangerous is unworthy to be called an idea at all.
~Elbert Hubbard
_______________________________________________
Tutor maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/tutor
Reply | Threaded
Open this post in threaded view
|

Re: getting 'pwd' for XP ?

dave s-6
On Thursday 28 September 2006 16:42, Shantanoo Mahajan wrote:

> +++ Dave S [28-09-06 16:10 +0100]:
> | I currently running XP (like a fish out of water :) and I need to know
> | the dir that the python script is executed from. a linux 'pwd' How can I
> | achieve this - I have looked in sys & os & os.path but found nothing
> | suitable
>
> ====================
> Python 2.4.3 (#2, Sep 26 2006, 15:27:42)
> [GCC 3.4.4 [FreeBSD] 20050518] on freebsd6
> Type "help", "copyright", "credits" or "license" for more information.
>
> >>> import os
> >>> os.getcwd()
>
> '/tmp'
>
> ====================

os.getcwd() it is - must have missed it - thanks

Dave
_______________________________________________
Tutor maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/tutor
Reply | Threaded
Open this post in threaded view
|

Re: getting 'pwd' for XP ?

शंतनू
In reply to this post by शंतनू
+++ Shantanoo Mahajan [28-09-06 21:12 +0530]:
| +++ Dave S [28-09-06 16:10 +0100]:
| | I currently running XP (like a fish out of water :) and I need to know the dir
| | that the python script is executed from. a linux 'pwd' How can I achieve
| | this - I have looked in sys & os & os.path but found nothing suitable
|
| ====================
| Python 2.4.3 (#2, Sep 26 2006, 15:27:42)
| [GCC 3.4.4 [FreeBSD] 20050518] on freebsd6
| Type "help", "copyright", "credits" or "license" for more information.
| >>> import os
| >>> os.getcwd()
| '/tmp'
| >>>  
| ====================

And I do not remember exactly whether it will work or not, but you may
try 'cd' instead of 'pwd' on windows. I do not have windows machine to
test, so cannot confirm whether it works or not.

--
Research is what I'm doing when I don't know what I'm doing. ~Wernher von Braun
_______________________________________________
Tutor maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/tutor