mechboxes / mech

Easy command line virtual machines for VMWare
https://mechboxes.github.io/mech/
MIT License
311 stars 49 forks source link

WindowsError: [Error 2] The system cannot find the file specified #9

Closed princepathria closed 7 years ago

princepathria commented 7 years ago
$ mech start deb8.6
Traceback (most recent call last):
  File "C:\Python27\Scripts\mech-script.py", line 11, in <module>
    load_entry_point('mech==0.4.1', 'console_scripts', 'mech')()
  File "c:\python27\lib\site-packages\mech\__main__.py", line 92, in main
    operation(op='start', name=name, options={'gui':gui})
  File "c:\python27\lib\site-packages\mech\__main__.py", line 49, in operation
    method()
  File "c:\python27\lib\site-packages\mech\mech.py", line 43, in start
    vm = Vmrun(self.vmx)
  File "c:\python27\lib\site-packages\mech\vmrun.py", line 69, in __init__
    rh = _winreg.OpenKey( reg, r'SOFTWARE\VMware, Inc.\VMware Workstation' )
WindowsError: [Error 2] The system cannot find the file specified
ColdHeat commented 7 years ago

Hmm interesting...

Windows isn't as heavily used as OSX is (my laptops are all OSX) but I'll take a look into this.

irakhlin commented 7 years ago

I am having the same issue, I think the specific error here is caused by looking up the wrong registry entry for vmware workstation. I believe VMWare Workstation is a 32bit application for windows..Atleast mine is (12.5.7 build-5813279): file vmware.exe vmware.exe: PE32 executable (GUI) Intel 80386, for MS Windows

This means that my registry entry "SOFTWARE\VMware, Inc.\VMware Workstation" does not exist. I think the registry entry you may be looking for is "SOFTWARE\WOW6432Node\VMware, Inc.\VMware Workstation"

In that case I have a "InstallPath" and "InstallPath64" which point to "C:\Program Files (x86)\VMware\VMware Workstation\" and "C:\Program Files (x86)\VMware\VMware Workstation\x64\" respectively.

I haven't look at any of your code to know where else this may need to be changed as I am having other issues but see if you can change that and give it a test?

irakhlin commented 7 years ago

Just to follow up that small change does fix it; the other issues I was having were totally unrelated and involved python/PATH issues. I now get: mech status: Total running VMs: 1

ColdHeat commented 7 years ago

Testing this on my computer, I can't reproduce but I'm looking into @irakhlin's fix now.

ColdHeat commented 7 years ago

Thanks @irakhlin I think that fix works. Checked my registry keys (Windows 10) and it looks like that's the correct value.

Will probably need to add a fallback just in case.