How to read files from virtual machine using Python

Discussion about using the VirtualBox API, Tutorials, Samples.
Post Reply
Golfer3082
Posts: 1
Joined: 24. Jan 2014, 14:32

How to read files from virtual machine using Python

Post by Golfer3082 »

I'm running a virtual machine on my system using Oracle VirtualBox , what i'm trying to accomplish is to read file on virtual machine from my physical system . i'm using virtualbox api (pyvbox) to interface with VirtualBox . This the first time i'm using a virtualbox api.

Code: Select all

>>> import virtualbox
>>> vbox = virtualbox.VirtualBox()
>>> vm =vbox.find_machine("XPBox")
>>> session = vm.create_session()
>>> gs = session.console.guest.create_session('xphandler' , ' qwerty')
>>> process, stdout, stderr = gs.execute('C:\\Windows\\System32\\cmd.exe', ['/C', 'tasklist'])

Traceback (most recent call last):
  File "<pyshell#29>", line 1, in <module>
    process, stdout, stderr = gs.execute('C:\\Windows\\System32\\cmd.exe', ['/C', 'tasklist'])
  File "C:\Python27\lib\site-packages\virtualbox\library_ext\guest_session.py", line 54, in execute
    process.wait_for(int(library.ProcessWaitResult.start), 0)
  File "C:\Python27\lib\site-packages\virtualbox\library.py", line 13666, in wait_for
    reason = ProcessWaitResult(reason)
  File "C:\Python27\lib\site-packages\virtualbox\library.py", line 121, in __init__
    raise ValueError("Can not find enumeration where value=%s" % value)
ValueError: Can not find enumeration where value=None
>>> 
This is the output when i type the below given solution.
maomao
Posts: 5
Joined: 24. Mar 2014, 09:47

Re: How to read files from virtual machine using Python

Post by maomao »

same question
noteirak
Site Moderator
Posts: 5229
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: How to read files from virtual machine using Python

Post by noteirak »

Could you give a bit more input here? Give a sample code, and give us the error you get and what you would expect to happen.
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
Post Reply