Saturday, February 21, 2015

command line - How to diagnose "Windows cannot access the specified device, path, or file" error?

When running Python script at the command line I get this error



Windows cannot access the specified device, path, or file. You man not
have the appropriate permissions to access the item.



How can I check what path does the system try to access? No entries are created in any of system logs (Application, Security, Setup, System). All solutions which I found on the web mention changing file's properties. The problem is in this case I don't know what file the system tries to use to handle Python script. How can I find this information? I guess a tool which monitors all files the system tries to open might help here.


Details


When I try to run Python script with .py extenstion at the command line by just giving script's name (like sample.py) I get the above error. I guess the problem is due to bad file association but... running reg query HKCR\.py /ve gives (Default) REG_SZ Python.File and reg query HKCR\Python.File\shell\open\command /ve gives
(Default) REG_SZ c:\python\2.7\python.exe "%1" %*
and the file c:\python\2.7\python.exe exists and I can run it from command line without problem. This makes me think that system tries to open Python script using some other path in the registry. The problem is I have no idea what's this path.


Windows Vista 64bit, running 64bit cmd.exe, 64bit Python.


EDIT


Process Monitor is very helpful but I still can't find the exact root causing problem. Trying to launch Python script generates 866 entries:


BUFFER TOO SMALL                 1
END OF FILE 1
FILE LOCKED WITH ONLY READERS 12
NAME NOT FOUND 301
NO MORE ENTRIES 4
REPARSE 5
SUCCESS 542

There's no NO SUCH FILE result. I think it's because system doesn't even try to launch the executable to open Python file with due to not being able to find suitable registry entry defining handler for .py files. There are 178 entires of type RegQueryKey and 141 entries of type RegQueryValue but I have hard time trying to draw any conclusion reading them.

No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...