Cannot run python script in windbg

Jan 19, 2015 at 2:35 PM
Edited Jan 19, 2015 at 2:36 PM
Hello All,
I have a problem with running python script in windbg.
I was able to load extension:
.load pykd.pyd
But I cannot run simple script:
!py c:\scripts\hello.py

Output is: 'script file not found'
I am pretty sure, that scripts exists in added location.
My OS: Windows 7 x86

Any ideas what could be wrong?
Coordinator
Jan 19, 2015 at 6:19 PM
Please, note a pykd version.
I've tried to run exactly the same command ( !py c:\scripts\hello.py ) and it seems it works fine for me. Try to check file attributes, may be "C:\scripts" or "hello.py" is not accessible for the current user? May be file is marked for deleting?
Coordinator
Jan 20, 2015 at 6:36 AM
I've found one case of the bug reproducing:
!py c:\scripts\HELLO.PY
returns 'script file not found'.

May it yours problem?
Jan 21, 2015 at 7:57 AM
Thank you for your replies. I have got x86 version, I can't tell which version exactly.
Version of Windbd is somehow modified from the original one.
Probably the error I got is because of this version.
Thank you for the reproduction :)

Maybe it could be something with environment paths? Or it does not matter?
Developer
Jan 21, 2015 at 9:43 PM
Edited Jan 21, 2015 at 9:44 PM
Please, try to run python console in windbg. Try type !pycmd .
Then type commands:
__version__   ( to see pykd version )

import sys
sys.path  (to see your python paths )

Pykd likes look through 'sys.path' list. May be your path variable has something bad for pykd. For the next version we have reworked search script procedure.
Coordinator
Jan 22, 2015 at 7:17 AM
Try this version:
https://pykd.codeplex.com/releases/view/610932

It has reworked algorithm of a script finding
Jan 27, 2015 at 8:26 AM
Hello Guys,

I have just downloaded the newest version. x64 but version works well (Windbg version - 6.3 ), but in Windbg x86 version (6.3.9600)has the same problem which I described at the beginning - script file not found. I have tried different paths.

Edit: After some debugging I found why I got this error:
when script file is bot seen as python script (it is silly for Windows), e.g. I opened notepad, copied there example script from this site and saved it as hello.py
Coordinator
Jan 27, 2015 at 9:04 AM
I did not understand a bit the last sentence. May be your problem is caused by virtualization for x86 application on x64 systems? Some paths can be seen by x86 applications different from x64.

Please let me known do you have problems with running scripts now?
Jan 27, 2015 at 10:26 AM
The problem was that when I created script in notepad Windows saved my simple script as hello.py.txt, not hello.py. That's script was missing :)
When I used python ide to write script, everything works fine :)