Python-mycheat-sheet
Method to check path from which the python module
>>> import os
>>> import inspect
>>> inspect.getfile(os)
'/usr/lib64/python2.7/os.pyc'
>>> inspect.getfile(inspect)
'/usr/lib64/python2.7/inspect.pyc'
>>> os.path.dirname(inspect.getfile(inspect))
'/usr/lib64/python2.7'
C:\WINDOWS\system32>assoc .py=Python.File
.py=Python.File
ftype Python.File="C:\Program Files\Python35" "%1" %*
ftype Python.File="C:\python279-64" "%1" %*
Python.File="C:\Program Files\Python35" "%1" %*
Python.File="C:\python279-64" "%1" %*
C:\>ftype | findstr -i python
Python.CompiledFile="C:\Python27\python.exe" "%1" %*
Python.File="C:\Python27\python.exe" "%1" %*
Python.NoConFile="C:\Python27\pythonw.exe" "%1" %*
ftype Python.CompiledFile="C:\CRMApps\Apps\Python262\python.exe" "%1" %*
ftype Python.File="C:\CRMApps\Apps\Python262\python.exe" "%1" %*
ftype Python.NoConFile="C:\CRMApps\Apps\Python262\pythonw.exe" "%1" %*
The next command shows the correct associations from my system:
C:\>assoc | findstr -i python
.py=Python.File
.pyc=Python.CompiledFile
.pyo=Python.CompiledFile
.pyw=Python.NoConFile
You can fix the associations with the following commands:
assoc .py=Python.File
assoc .pyc=Python.CompiledFile
assoc .pyo=Python.CompiledFile
assoc .pyw=Python.NoConFile
python -c "import os;import inspect;inspect.getfile(os)"
python -c "import ntlm;import inspect;inspect.getfile(ntlm)"
inspect.getfile(gerritssh)
Comments
Post a Comment