Status: Accepted
Owner: pekka.klarck
Labels: Priority-Critical Type-Defect Target-2.7.1
New issue 1095 by pekka.klarck: Crash when resource or variable file is not
found directly and PYTHONPATH contains non-ASCII paths
http://code.google.com/p/robotframework/issues/detail?id=1095
When investigating a problem with non-ASCII paths in PYTHONPATH with
library imports (issue 1092), I noticed a more serious issue with variable
and resource files.
To reproduce:
1) Have a test case file with name tests.txt and this content:
*** Settings ***
Resource non_existing.txt
*** Test Cases ***
Whatever No operation
2) mkdir öööö
3) PYTHONPATH=öööö pybot tests.txt
=>
Expected result:
Tests executed with a non-fatal error telling that resource file
non_existing.txt was not found.
Actual results:
The whole test execution crashes with following traceback:
[ ERROR ] Unexpected error: UnicodeDecodeError: 'ascii' codec can't decode
byte 0xc3 in position 32: ordinal not in range(128)
Traceback (most recent call last):
File "./src/robot/run.py", line 349, in main
suite.run(output)
File "/home/peke/Devel/robotframework/src/robot/running/model.py", line
119, in run
self._run_sub_suites(context)
File "/home/peke/Devel/robotframework/src/robot/running/model.py", line
165, in _run_sub_suites
suite.run(context.output, self, self.run_errors)
File "/home/peke/Devel/robotframework/src/robot/running/model.py", line
117, in run
context = self._start_run(output, parent, errors)
File "/home/peke/Devel/robotframework/src/robot/running/model.py", line
136, in _start_run
ns.handle_imports()
File "/home/peke/Devel/robotframework/src/robot/running/namespace.py",
line 60, in handle_imports
self._handle_imports(self.suite.imports)
File "/home/peke/Devel/robotframework/src/robot/running/namespace.py",
line 78, in _handle_imports
self._import(item)
File "/home/peke/Devel/robotframework/src/robot/running/namespace.py",
line 86, in _import
action(import_setting, self.variables.current)
File "/home/peke/Devel/robotframework/src/robot/running/namespace.py",
line 92, in _import_resource
path = self._resolve_name(import_setting, variables)
File "/home/peke/Devel/robotframework/src/robot/running/namespace.py",
line 144, in _resolve_name
return self._get_path(name, import_setting.directory,
import_setting.type)
File "/home/peke/Devel/robotframework/src/robot/running/namespace.py",
line 154, in _get_path
return self._resolve_path(name.replace('/', os.sep), basedir)
File "/home/peke/Devel/robotframework/src/robot/running/namespace.py",
line 167, in _resolve_path
ret = os.path.join(base, path)
File "/usr/lib/python2.6/posixpath.py", line 70, in join
path += '/' + b