robotframework-ioslibrary
robotframework-ioslibrary copied to clipboard
Importing test library 'IOSLibrary' failed: ImportError: cannot import name GLOBAL_VARIABLES
When I tried to import the IOSLibrary to my RobotFramework, it failed!! i have tried to delete the folder and then reinstall, but it didn't work for me!!
How can I resolve it?
Same for me.
Guys, any updates?
https://testerhome.com/topics/2986 After I resolved the issue, I wrote a page here.
You can check it~~
1、Find file [ini.py] under robot->variables 2、Change the content as below : import os import tempfile
from robot import utils from robot.output import LOGGER
from .assigner import VariableAssigner from .isvar import contains_var, is_var, is_scalar_var, is_list_var, is_dict_var from .notfound import variable_not_found from .scopes import VariableScopes from .splitter import VariableSplitter, VariableIterator from .tablesetter import VariableTableValue, DictVariableTableValue from .variables import Variables
GLOBAL_VARIABLES = Variables()
def init_global_variables(settings): GLOBAL_VARIABLES.clear() _set_cli_vars(settings) for name, value in [ ('${TEMPDIR}', utils.abspath(tempfile.gettempdir())), ('${EXECDIR}', utils.abspath('.')), ('${/}', os.sep), ('${:}', os.pathsep), ('${\n}', os.linesep), ('${SPACE}', ' '), ('${EMPTY}', ''), ('@{EMPTY}', ()), ('${True}', True), ('${False}', False), ('${None}', None), ('${null}', None), ('${OUTPUT_DIR}', settings['OutputDir']), ('${OUTPUT_FILE}', settings['Output'] or 'NONE'), ('${REPORT_FILE}', settings['Report'] or 'NONE'), ('${LOG_FILE}', settings['Log'] or 'NONE'), ('${LOG_LEVEL}', settings['LogLevel']), ('${DEBUG_FILE}', settings['DebugFile'] or 'NONE'), ('${PREV_TEST_NAME}', ''), ('${PREV_TEST_STATUS}', ''), ('${PREV_TEST_MESSAGE}', '') ]: GLOBAL_VARIABLES[name] = value
def _set_cli_vars(settings): for path, args in settings['VariableFiles']: try: GLOBAL_VARIABLES.set_from_file(path, args) except: msg, details = utils.get_error_details() LOGGER.error(msg) LOGGER.info(details) for varstr in settings['Variables']: try: name, value = varstr.split(':', 1) except ValueError: name, value = varstr, '' GLOBAL_VARIABLES['${%s}' % name] = value
@qingzhang2014,
Doesn't work for me. Dies with message File "/Library/Python/2.7/site-packages/robot/variables/init.py", line 32 GLOBAL_VARIABLES.clear() ^ IndentationError: expected an indented block
FYI, I've updated file /Library/Python/2.7/site-packages/robot/variables/init.py