if i am importing file then there is no issue .. simply i can get it with
__file__
like tempPython.__file__ it will return the file name of imported module.

But in my case i am not importing anything simply running with python using

python tempPython.py thats it

On Thu, Apr 23, 2009 at 2:35 PM, pierrotb <[email protected]> wrote:

>
> What is the command that you use to "run" your file ? do you use :
> import tempPython ?
>
> On 23 avr, 10:54, kurian os ™ ®കോപ്പിയടിച്ചാല്©ഗോതമ്പുണ്ട!
> <[email protected]> wrote:
> > Hi
> > thanks for your idea ..
> >
> > but print sys.modules.get('tempPython') ,
> > it will return as None .
> >
> > I think maybe i made confuse , I want to get the file path of current
> file
> > which i am running
> >
> > for eg: I am running a file called tempPython.py
> >
> > inside this python file I want to get file path of tempPython.py and i
> want
> > to print it .
> >
> > Is that clear ??
> >
> > and i am sorry for my bad English:)
> >
> >
> >
> > On Thu, Apr 23, 2009 at 2:08 PM, pierrotb <[email protected]>
> wrote:
> >
> > > You can use this.
> > > sys.modules.get('idlelib')
> > > <module 'idlelib' from 'C:\Python25\Lib\idlelib\__init__.pyc'>
> >
> > > On 23 avr, 09:51, Achayan <[email protected]> wrote:
> > > > Hi All
> >
> > > > I have doubt , is there any way to find a file path in python ??
> >
> > > > for eg: I have a file named as testPython.py and its saved in D:\Temp
> > > > While i am running the  testPython.py i need to find from where is
> > > > getting sourced .
> > > > Is there any chance ??
> >
> > > > I got a information about __file__ but it will work only if we import
> > > > this script.
> > > > Without importing the file i need to find the file path.
> >
> > > > Any help :)
> >
> > > > Thanks
> >
> > > > O.S.K
> >
> > --
> > സ്നേഹിക്കയില്ല ഞാന്‍
> > നോവുമാത്മാവിനെ സ്നേഹിച്ചിടാത്തൊരു
> > തത്വശാസ്ത്രത്തെയും
> >
>


-- 
സ്നേഹിക്കയില്ല ഞാന്‍
നോവുമാത്മാവിനെ സ്നേഹിച്ചിടാത്തൊരു
തത്വശാസ്ത്രത്തെയും

--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/python_inside_maya
-~----------~----~----~----~------~----~------~--~---

  • ... Achayan
    • ... pierrotb
      • ... kurian os ™ ®കോപ്പിയടിച്ചാല്©ഗോതമ്പുണ്ട!
        • ... pierrotb
          • ... kurian os ™ ®കോപ്പിയടിച്ചാല്©ഗോതമ്പുണ്ട!
            • ... pierrotb
              • ... Chad Dombrova
                • ... kurian os ™ ®കോപ്പിയടിച്ചാല്©ഗോതമ്പുണ്ട!
                • ... jason . osipa
    • ... Bård Henriksen
      • ... Paul Molodowitch
        • ... Chris G
          • ... Paul Molodowitch
            • ... kurian os ™ ®കോപ്പിയടിച്ചാല്©ഗോതമ്പുണ്ട!

Reply via email to