我試圖運行Win7上下面的Python代碼2.7.10錯誤的文件描述:IO錯誤:[錯誤9]使用機器人框架和Python
from robot import run
run("Login.robot", variable=['USERNAME:[email protected]'])
Login.robot是一個非常簡單的機器人框架的測試,打開一個瀏覽器窗口,加載我們的登錄頁面,輸入用戶名和密碼,然後確認用戶已經登錄。我已經通過pybot在命令行運行它並且測試套件正確運行來測試它。但試圖從這個腳本運行測試套件生成
Traceback (most recent call last):
File "C:\Users\dmdunn\Desktop\test_user_data.py", line 4, in <module>
run("Login.robot", variable=['USERNAME:[email protected]'])
File "C:\Python27\lib\site-packages\robot\run.py", line 471, in run
return RobotFramework().execute(*datasources, **options)
File "C:\Python27\lib\site-packages\robot\utils\application.py", line 83, in execute
return self._execute(list(arguments), options)
File "C:\Python27\lib\site-packages\robot\utils\application.py", line 96, in _execute
details, rc=FRAMEWORK_ERROR)
File "C:\Python27\lib\site-packages\robot\utils\application.py", line 110, in _report_error
self._logger.error(message)
File "C:\Python27\lib\site-packages\robot\output\loggerhelper.py", line 59, in error
self.write(msg, 'ERROR')
File "C:\Python27\lib\site-packages\robot\output\loggerhelper.py", line 62, in write
self.message(Message(message, level, html))
File "C:\Python27\lib\site-packages\robot\output\logger.py", line 109, in message
logger.message(msg)
File "C:\Python27\lib\site-packages\robot\output\monitor.py", line 66, in message
self._writer.error(msg.message, msg.level, clear=self._running_test)
File "C:\Python27\lib\site-packages\robot\output\monitor.py", line 142, in error
self._highlight('[ ', level, ' ] ' + message, error=True)
File "C:\Python27\lib\site-packages\robot\output\monitor.py", line 158, in _highlight
self._write(before, newline=False, error=error)
File "C:\Python27\lib\site-packages\robot\output\monitor.py", line 154, in _write
stream.flush()
IOError: [Errno 9] Bad file descriptor
有什麼建議嗎?我嘗試過使用機器人文件的絕對路徑,單引號,雙引號,通過打開的文件對象引用,通過關閉的文件對象引用。謝謝!
我無法複製您的問題。您的代碼完全按照我發佈在Linux機器上的方式運行。 –
那麼,至少現在我知道這是一個Windows問題。 –