2014-01-11 40 views
3

對於虛擬幀緩衝(無頭測試),我使用XvfbPyVirtualDisplay,它在Ubuntu中工作正常,但在Windows7中顯示錯誤。這裏是發生問題的代碼的一部分。窗口中的Python XVFB錯誤

from pyvirtualdisplay import Display 
display = Display(visible=1, size=(300, 400)) 
display.start() 

但是當我在Windows中運行相同的命令,我得到這個錯誤

Traceback (most recent call last): 
    File "C:\Python27\Scripts\pynt-script.py", line 9, in <module> 
    load_entry_point('pynt==0.8.0', 'console_scripts', 'pynt')() 
    File "C:\Python27\lib\site-packages\pynt\_pynt.py", line 295, in main 
    build(sys.argv[1:]) 
    File "C:\Python27\lib\site-packages\pynt\_pynt.py", line 48, in build 
    module = imp.load_source(path.splitext(path.basename(args.file))[0], args.fi 
le) 
    File "build.py", line 7, in <module> 
    display = Display(visible=1, size=(300,400)) 
    File "C:\Python27\lib\site-packages\pyvirtualdisplay\display.py", line 33, in 
__init__ 
    self._obj = self.display_class(
    File "C:\Python27\lib\site-packages\pyvirtualdisplay\display.py", line 50, in 
display_class 
    cls.check_installed() 
    File "C:\Python27\lib\site-packages\pyvirtualdisplay\xvfb.py", line 34, in che 
ck_installed 
    ubuntu_package=PACKAGE).check_installed() 
    File "C:\Python27\lib\site-packages\easyprocess\__init__.py", line 209, in che 
ck_installed 
    raise EasyProcessCheckInstalledError(self) 
easyprocess.EasyProcessCheckInstalledError: cmd=['Xvfb', '-help'] 
OSError=[Error 2] The system cannot find the file specified 
Program install error! 

我覺得我的方案是不是能夠找到xvfb的程序/庫? 我安裝了xvfbwrapper(https://github.com/cgoldberg/xvfbwrapper),但問題仍然保持不變。再次我認爲xvfbwrapper與xvfb不同?

任何替代的Windows平臺,可以做無頭測試(虛擬幀緩存)

回答

2

你得到一個錯誤,因爲沒有找到命令Xvfb。 Xvfb是X虛擬幀緩衝區,它不是Microsoft Windows 7的一部分。

+1

您不能在Windows上安裝Xvfb。看這個[回答](http://superuser.com/a/480261/124457) –