ModelErrorResponseException: Unauthorized Azure ML authorization bug - python

after successfully running a training estimator and experiment in an azure ml notebook I am being given Unauthorized errors when trying to register the model. I also see an unauthorized bar pop up in the top when I look at the estimator or the models tab in the azure portal.
This seems like it could be a resource group issue, but I only have one resource group. Has anyone had this issue before?
successful experiment:
from azureml.core.experiment import Experiment
script_params = {
# '--num_epochs': 3,
'--output_dir': './outputs'
}
estimator = PyTorch(source_directory=os.path.join(os.getcwd(), 'Estimator'),
script_params=script_params,
compute_target=compute_target,
entry_script='train.py',
use_gpu=True,
pip_packages=['pillow==5.4.1', 'torch', 'numpy'])
experiment_name = 'pytorch-rnn-generator'
experiment = Experiment(ws, name=experiment_name)
run = experiment.submit(estimator)
run.wait_for_completion(show_output=True)
model registration:
model = run.register_model(model_name='rnn-tv-script-gen', model_path='outputs/')
The stack trace:
ModelErrorResponseException Traceback (most recent call last)
<ipython-input-6-178d7ee9830a> in <module>
1 from azureml.core.model import Model
2
----> 3 model = run.register_model(model_name='rnn-tv-script-gen', model_path='outputs/')
4
5 servive = Model.deploy(ws,
/anaconda/envs/azureml_py36/lib/python3.6/site-packages/azureml/core/run.py in register_model(self, model_name, model_path, tags, properties, model_framework, model_framework_version, description, datasets, sample_input_dataset, sample_output_dataset, resource_configuration, **kwargs)
1988 model_name, model_path, tags, properties, model_framework, model_framework_version,
1989 description=description, datasets=datasets, unpack=False, sample_input_dataset=sample_input_dataset,
-> 1990 sample_output_dataset=sample_output_dataset, resource_configuration=resource_configuration, **kwargs)
1991
1992 def _update_dataset_lineage(self, datasets):
/anaconda/envs/azureml_py36/lib/python3.6/site-packages/azureml/_run_impl/run_history_facade.py in register_model(self, model_name, model_path, tags, properties, model_framework, model_framework_version, asset_id, sample_input_dataset, sample_output_dataset, resource_configuration, **kwargs)
386 artifacts,
387 metadata_dict=metadata_dict,
--> 388 run_id=self._run_id)
389 asset_id = asset.id
390 else:
/anaconda/envs/azureml_py36/lib/python3.6/site-packages/azureml/_restclient/assets_client.py in create_asset(self, model_name, artifact_values, metadata_dict, project_id, run_id, tags, properties)
50 "meta": metadata_dict,
51 "CreatedTime": created_time}
---> 52 return self._execute_with_workspace_arguments(self._client.asset.create, payload)
53
54 def get_assets_by_run_id_and_name(self, run_id, name):
/anaconda/envs/azureml_py36/lib/python3.6/site-packages/azureml/_restclient/workspace_client.py in _execute_with_workspace_arguments(self, func, *args, **kwargs)
69
70 def _execute_with_workspace_arguments(self, func, *args, **kwargs):
---> 71 return self._execute_with_arguments(func, copy.deepcopy(self._workspace_arguments), *args, **kwargs)
72
73 def _execute_with_arguments(self, func, args_list, *args, **kwargs):
/anaconda/envs/azureml_py36/lib/python3.6/site-packages/azureml/_restclient/workspace_client.py in _execute_with_arguments(self, func, args_list, *args, **kwargs)
85 return self._call_paginated_api(func, *args_list, **kwargs)
86 else:
---> 87 return self._call_api(func, *args_list, **kwargs)
88 except ErrorResponseException as e:
89 raise ServiceException(e)
/anaconda/envs/azureml_py36/lib/python3.6/site-packages/azureml/_restclient/clientbase.py in _call_api(self, func, *args, **kwargs)
224 return AsyncTask(future, _ident=ident, _parent_logger=self._logger)
225 else:
--> 226 return self._execute_with_base_arguments(func, *args, **kwargs)
227
228 def _call_paginated_api(self, func, *args, **kwargs):
/anaconda/envs/azureml_py36/lib/python3.6/site-packages/azureml/_restclient/clientbase.py in _execute_with_base_arguments(self, func, *args, **kwargs)
277 total_retry = 0 if self.retries < 0 else self.retries
278 return ClientBase._execute_func_internal(
--> 279 back_off, total_retry, self._logger, func, _noop_reset, *args, **kwargs)
280
281 #classmethod
/anaconda/envs/azureml_py36/lib/python3.6/site-packages/azureml/_restclient/clientbase.py in _execute_func_internal(cls, back_off, total_retry, logger, func, reset_func, *args, **kwargs)
292 return func(*args, **kwargs)
293 except Exception as error:
--> 294 left_retry = cls._handle_retry(back_off, left_retry, total_retry, error, logger, func)
295
296 reset_func(*args, **kwargs) # reset_func is expected to undo any side effects from a failed func call.
/anaconda/envs/azureml_py36/lib/python3.6/site-packages/azureml/_restclient/clientbase.py in _handle_retry(cls, back_off, left_retry, total_retry, error, logger, func)
341 back_off = DEFAULT_503_BACKOFF
342 elif error.response.status_code < 500:
--> 343 raise error
344 elif not isinstance(error, RETRY_EXCEPTIONS):
345 raise error
/anaconda/envs/azureml_py36/lib/python3.6/site-packages/azureml/_restclient/clientbase.py in _execute_func_internal(cls, back_off, total_retry, logger, func, reset_func, *args, **kwargs)
290 while left_retry >= 0:
291 try:
--> 292 return func(*args, **kwargs)
293 except Exception as error:
294 left_retry = cls._handle_retry(back_off, left_retry, total_retry, error, logger, func)
/anaconda/envs/azureml_py36/lib/python3.6/site-packages/azureml/_restclient/operations/asset_operations.py in create(self, subscription_id, resource_group_name, workspace, asset, custom_headers, raw, **operation_config)
88
89 if response.status_code not in [200]:
---> 90 raise models.ModelErrorResponseException(self._deserialize, response)
91
92 deserialized = None
ModelErrorResponseException: Unauthorized

Definitely a strange error. Looks like you're using this guide as a reference. Without seeing what your train.py looks like, I'd be curious to know if you:
get the error when running the ipynb of the guide without making any changes?
still have a snippet like below in your code?
os.makedirs(args.output_dir, exist_ok=True)
torch.save(model, os.path.join(args.output_dir, 'model.pt'))
get a similar error if you try to download the file like shown in the second snippet of this docs section?

Related

no NoSuchKey: An error occurred (NoSuchKey) when calling the GetObject operation: The specified key does not exist

I am trying to access a file from s3 but i keep getting the error:
NoSuchKey: An error occurred (NoSuchKey) when calling the GetObject operation: The specified key does not exist.
import boto3
s3 = boto3.resource('s3')
bucket_name = "test_bucket"
folder_for_resources = "s3://test_bucket/development/resources/"
bucket = s3.Bucket(bucket_name)
I then try to get the object
obj=s3.Object(bucket_name,f"{folder_for_resources}test.json")
file_content = obj.get()['Body'].read().decode('utf-8')
a2c_old = json.load(file_content)
What am I doing wrong? full traceback:
---------------------------------------------------------------------------
NoSuchKey Traceback (most recent call last)
<ipython-input-11-1a964eacf78b> in <module>
1 print(f"{folder_for_resources}test.json")
2 obj=s3.Object(bucket_name,f"{folder_for_resources}test.json")
----> 3 file_content = obj.get()['Body'].read().decode('utf-8')
4 a2c_old = json.load(file_content)
~/.pyenv/versions/3.6.10/lib/python3.6/site-packagtestes/boto3/resources/factory.py in do_action(self, *args, **kwargs)
518 # instance via ``self``.
519 def do_action(self, *args, **kwargs):
--> 520 response = action(self, *args, **kwargs)
521
522 if hasattr(self, 'load'):
~/.pyenv/versions/3.6.10/lib/python3.6/site-packages/boto3/resources/action.py in __call__(self, parent, *args, **kwargs)
81 operation_name, params)
82
---> 83 response = getattr(parent.meta.client, operation_name)(*args, **params)
84
85 logger.debug('Response: %r', response)
~/.pyenv/versions/3.6.10/lib/python3.6/site-packages/botocore/client.py in _api_call(self, *args, **kwargs)
355 "%s() only accepts keyword arguments." % py_operation_name)
356 # The "self" in this scope is referring to the BaseClient.
--> 357 return self._make_api_call(operation_name, kwargs)
358
359 _api_call.__name__ = str(py_operation_name)
~/.pyenv/versions/3.6.10/lib/python3.6/site-packages/botocore/client.py in _make_api_call(self, operation_name, api_params)
674 error_code = parsed_response.get("Error", {}).get("Code")
675 error_class = self.exceptions.from_code(error_code)
--> 676 raise error_class(parsed_response, operation_name)
677 else:
678 return parsed_response
NoSuchKey: An error occurred (NoSuchKey) when calling the GetObject operation: The specified key does not exist.
The issue was with:
folder_for_resources = "s3://test_bucket/development/resources/"
This should have been set as:
folder_for_resources = "development/resources/"

SQLAlchemy-TypeError: _get_column_info() got an unexpected keyword argument 'generated'

I'm trying to get metadata of the table from the Redshift database.
I'm getting the error even though the connection is fine.
"TypeError: _get_column_info() got an unexpected keyword argument 'generated'"
I tried with another databse of a different server it works fine...
But not sure whats the issue with this server tables.
Can you please help me out with a solution.
Table=sa.Table("Tablename" ,metadata,autoload=True,autoload_with=engine)
TypeError Traceback (most recent call last)
<ipython-input-98-366ec112cf52> in <module>
----> 1 Table=sa.Table("dim_dealer" ,metadata,autoload=True,autoload_with=engine)
<string> in __new__(cls, *args, **kw)
~\AppData\Local\Continuum\anaconda3\lib\site-packages\sqlalchemy\util\deprecations.py in warned(fn, *args, **kwargs)
126 )
127
--> 128 return fn(*args, **kwargs)
129
130 doc = fn.__doc__ is not None and fn.__doc__ or ""
~\AppData\Local\Continuum\anaconda3\lib\site-packages\sqlalchemy\sql\schema.py in __new__(cls, *args, **kw)
494 except:
495 with util.safe_reraise():
--> 496 metadata._remove_table(name, schema)
497
498 #property
~\AppData\Local\Continuum\anaconda3\lib\site-packages\sqlalchemy\util\langhelpers.py in __exit__(self, type_, value, traceback)
66 self._exc_info = None # remove potential circular references
67 if not self.warn_only:
---> 68 compat.reraise(exc_type, exc_value, exc_tb)
69 else:
70 if not compat.py3k and self._exc_info and self._exc_info[1]:
~\AppData\Local\Continuum\anaconda3\lib\`enter code here`site-packages\sqlalchemy\util\compat.py in reraise(tp, value, tb, cause)
151 if value.__traceback__ is not tb:
152 raise value.with_traceback(tb)
--> 153 raise value
154
155 def u(s):
~\AppData\Local\Continuum\anaconda3\lib\site-packages\sqlalchemy\sql\schema.py in __new__(cls, *args, **kw)
489 metadata._add_table(name, schema, table)
490 try:
--> 491 table._init(name, metadata, *args, **kw)
492 table.dispatch.after_parent_attach(table, metadata)
493 return table
~\AppData\Local\Continuum\anaconda3\lib\site-packages\sqlalchemy\sql\schema.py in _init(self, name, metadata, *args, **kwargs)
583 include_columns,
584 _extend_on=_extend_on,
--> 585 resolve_fks=resolve_fks,
586 )
587
~\AppData\Local\Continuum\anaconda3\lib\site-packages\sqlalchemy\sql\schema.py in _autoload(self, metadata, autoload_with, include_columns, exclude_columns, resolve_fks, _extend_on)
607 exclude_columns,
608 resolve_fks,
--> 609 _extend_on=_extend_on,
610 )
611 else:
~\AppData\Local\Continuum\anaconda3\lib\site-packages\sqlalchemy\engine\base.py in run_callable(self, callable_, *args, **kwargs)
2148 """
2149 with self._contextual_connect() as conn:
-> 2150 return conn.run_callable(callable_, *args, **kwargs)
2151
2152 def execute(self, statement, *multiparams, **params):
~\AppData\Local\Continuum\anaconda3\lib\site-packages\sqlalchemy\engine\base.py in run_callable(self, callable_, *args, **kwargs)
1602
1603 """
-> 1604 return callable_(self, *args, **kwargs)
1605
1606 def _run_visitor(self, visitorcallable, element, **kwargs):
~\AppData\Local\Continuum\anaconda3\lib\site-packages\sqlalchemy\engine\default.py in reflecttable(self, connection, table, include_columns, exclude_columns, resolve_fks, **opts)
429 insp = reflection.Inspector.from_engine(connection)
430 return insp.reflecttable(
--> 431 table, include_columns, exclude_columns, resolve_fks, **opts
432 )
433
~\AppData\Local\Continuum\anaconda3\lib\site-packages\sqlalchemy\engine\reflection.py in reflecttable(self, table, include_columns, exclude_columns, resolve_fks, _extend_on)
638
639 for col_d in self.get_columns(
--> 640 table_name, schema, **table.dialect_kwargs
641 ):
642 found_table = True
~\AppData\Local\Continuum\anaconda3\lib\site-packages\sqlalchemy\engine\reflection.py in get_columns(self, table_name, schema, **kw)
371
372 col_defs = self.dialect.get_columns(
--> 373 self.bind, table_name, schema, info_cache=self.info_cache, **kw
374 )
375 for col_def in col_defs:
<string> in get_columns(self, connection, table_name, schema, **kw)
~\AppData\Local\Continuum\anaconda3\lib\site-packages\sqlalchemy\engine\reflection.py in cache(fn, self, con, *args, **kw)
54 ret = info_cache.get(key)
55 if ret is None:
---> 56 ret = fn(self, con, *args, **kw)
57 info_cache[key] = ret
58 return ret
~\AppData\Local\Continuum\anaconda3\lib\site-packages\sqlalchemy_redshift\dialect.py in get_columns(self, connection, table_name, schema, **kw)
459 default=col.default, notnull=col.notnull, domains=domains,
460 enums=[], schema=col.schema, encode=col.encode,
--> 461 comment=col.comment)
462 columns.append(column_info)
463 return columns
~\AppData\Local\Continuum\anaconda3\lib\site-packages\sqlalchemy_redshift\dialect.py in _get_column_info(self, *args, **kwargs)
666 column_info = super(RedshiftDialect, self)._get_column_info(
667 *args,
--> 668 **kw
669 )
670 if isinstance(column_info['type'], VARCHAR):
TypeError: _get_column_info() got an unexpected keyword argument 'generated'
print(repr(metadata.tables[Table]))
Thanks in advance
It looks like a backwards compatibility bug between SQLAlchemy and SQLAlchemy-Redshift.
Private method RedshiftDialect._get_column_info was overriden in SQLAlchemy-Redshift. generated keyword argument was added to this method in SQLAlchemy v1.3.16 which caused compatibility error. So a fix for this problem was implemented: generated keyword should be used only for the latest versions of SQLAlchemy. Unfortunately it doesn't work:
if sa.__version__ >= '1.3.16':
# SQLAlchemy 1.3.16 introduced generated columns,
# not supported in redshift
kw['generated'] = ''
As you can see this condition is truthy for your SQLAlchemy version ("1.3.7") because this is how string comparison works. I think I will make a pull request to correct this behaviour.
I think the most simple solution for you for now is to update your SQLAlchemy package to the 1.3.10 version or newer. In this case this condition will work as expected.
Update: This bug was fixed in the SQLAlchemy-Redshift v0.8.0.

how can i convert a string column to a date type using apply() function

Although I have used another method i.e astype(datetime[ns]) and it worked, but I still want to know why this code gives an error
'''transaction['transaction_date'] = transaction['transaction_date'].apply([lambda x :datetime.strptime(x,"%y-%m-%d, %H:%M:%S")])'''
it gives this error message
ValueError Traceback (most recent call last)
<ipython-input-76-17fc8b725c4b> in <module>
----> 1 transaction['transaction_date'] = transaction['transaction_date'].apply([lambda x :datetime.strptime(x,"%y-%m-%d, %H:%M:%S")])
~\Anacondas\lib\site-packages\pandas\core\series.py in apply(self, func, convert_dtype, args, **kwds)
3821 # dispatch to agg
3822 if isinstance(func, (list, dict)):
-> 3823 return self.aggregate(func, *args, **kwds)
3824
3825 # if we are a string, try to dispatch
~\Anacondas\lib\site-packages\pandas\core\series.py in aggregate(self, func, axis, *args, **kwargs)
3686 # Validate the axis parameter
3687 self._get_axis_number(axis)
-> 3688 result, how = self._aggregate(func, *args, **kwargs)
3689 if result is None:
3690
~\Anacondas\lib\site-packages\pandas\core\base.py in _aggregate(self, arg, *args, **kwargs)
484 elif is_list_like(arg):
485 # we require a list, but not an 'str'
--> 486 return self._aggregate_multiple_funcs(arg, _axis=_axis), None
487 else:
488 result = None
~\Anacondas\lib\site-packages\pandas\core\base.py in _aggregate_multiple_funcs(self, arg, _axis)
549 # if we are empty
550 if not len(results):
--> 551 raise ValueError("no results")
552
553 try:
ValueError: no results

Type error making a betfair.py API call

I've just been moving some code over to a Ubuntu 16.04.2 anaconda setup, and am getting a type error I don't understand when calling code which works fine across numerous other machines.
The error replicates for me just off of the list all tennis markets sample code in the repo below, as well as a request like:
from betfair import Betfair
client = Betfair("app key needed here", "path to ssh key here")
client.login(username, password)
client.keep_alive()
client.list_market_book(market_ids=['1.135391020'], price_projection=dict(priceData=['EX_BEST_OFFERS']))
or
from betfair.models import MarketFilter
event_types = client.list_event_types(
MarketFilter(text_query='tennis')
)
print(len(event_types)) # 2
print(event_types[0].event_type.name) # 'Tennis'
tennis_event_type = event_types[0]
markets = client.list_market_catalogue(
MarketFilter(event_type_ids=[tennis_event_type.event_type.id])
)
markets[0].market_name
Both throw the following type error despite identical code working on a windows installation:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-3-69b51cf78438> in <module>()
1 event_types = client.list_event_types(
----> 2 MarketFilter(text_query='tennis')
3 )
4 print(len(event_types)) # 2
5 print(event_types[0].event_type.name) # 'Tennis'
<decorator-gen-125> in list_event_types(self, filter, locale)
/home/user/anaconda2/lib/python2.7/site-packages/betfair/utils.pyc in requires_login(func, *args, **kwargs)
121 self = args[0]
122 if self.session_token:
--> 123 return func(*args, **kwargs)
124 raise exceptions.NotLoggedIn()
/home/user/anaconda2/lib/python2.7/site-packages/betfair/betfair.pyc in list_event_types(self, filter, locale)
148 'listEventTypes',
149 utils.get_kwargs(locals()),
--> 150 model=models.EventTypeResult,
151 )
152
/home/user/anaconda2/lib/python2.7/site-packages/betfair/betfair.pyc in make_api_request(self, base, method, params, codes, model)
87 utils.check_status_code(response, codes=codes)
88 result = utils.result_or_error(response)
---> 89 return utils.process_result(result, model)
90
91 # Authentication methods
/home/user/anaconda2/lib/python2.7/site-packages/betfair/utils.pyc in process_result(result, model)
81 return result
82 if isinstance(result, collections.Sequence):
---> 83 return [model(**item) for item in result]
84 return model(**result)
85
/home/user/anaconda2/lib/python2.7/site-packages/betfair/meta/models.pyc in __init__(self, **data)
24 def __init__(self, **data):
25 super(BetfairModel, self).__init__()
---> 26 self.import_data(data)
27
28 def import_data(self, data, **kwargs):
/home/user/anaconda2/lib/python2.7/site-packages/betfair/meta/models.pyc in import_data(self, data, **kwargs)
28 def import_data(self, data, **kwargs):
29 kwargs['strict'] = False
---> 30 return super(BetfairModel, self).import_data(data, **kwargs)
/home/user/anaconda2/lib/python2.7/site-packages/schematics/models.pyc in import_data(self, raw_data, recursive, **kwargs)
269 The data to be imported.
270 """
--> 271 data = self._convert(raw_data, trusted_data=_dict(self), recursive=recursive, **kwargs)
272 self._data.converted.update(data)
273 if kwargs.get('validate'):
/home/user/anaconda2/lib/python2.7/site-packages/schematics/models.pyc in _convert(self, raw_data, context, **kwargs)
293 should_validate = getattr(context, 'validate', kwargs.get('validate', False))
294 func = validate if should_validate else convert
--> 295 return func(self._schema, self, raw_data=raw_data, oo=True, context=context, **kwargs)
296
297 def export(self, field_converter=None, role=None, app_data=None, **kwargs):
/home/user/anaconda2/lib/python2.7/site-packages/schematics/transforms.pyc in convert(cls, mutable, raw_data, **kwargs)
427
428 def convert(cls, mutable, raw_data=None, **kwargs):
--> 429 return import_loop(cls, mutable, raw_data, import_converter, **kwargs)
430
431
/home/user/anaconda2/lib/python2.7/site-packages/schematics/transforms.pyc in import_loop(schema, mutable, raw_data, field_converter, trusted_data, mapping, partial, strict, init_values, apply_defaults, convert, validate, new, oo, recursive, app_data, context)
153 field_context = context
154 try:
--> 155 value = _field_converter(field, value, field_context)
156 except (FieldError, CompoundError) as exc:
157 errors[serialized_field_name] = exc
/home/user/anaconda2/lib/python2.7/site-packages/schematics/transforms.pyc in __call__(self, *args)
354
355 def __call__(self, *args):
--> 356 return self.func(*args)
357
358
/home/user/anaconda2/lib/python2.7/site-packages/schematics/transforms.pyc in import_converter(field, value, context)
382 if value is None or value is Undefined:
383 return value
--> 384 return field.convert(value, context)
385
386
/home/user/anaconda2/lib/python2.7/site-packages/schematics/types/compound.pyc in convert(self, value, context)
34 def convert(self, value, context=None):
35 context = context or get_import_context()
---> 36 return self._convert(value, context)
37
38 def _convert(self, value, context):
/home/user/anaconda2/lib/python2.7/site-packages/schematics/types/compound.pyc in _convert(self, value, context)
131 "Input must be a mapping or '%s' instance" % self.model_class.__name__)
132 if context.convert and context.oo:
--> 133 return model_class(value, context=context)
134 else:
135 return model_class.convert(value, context=context)
TypeError: __init__() takes exactly 1 argument (3 given)
Somewhat weirder, a request like:
client.list_market_catalogue(MarketFilter(market_ids=['1.135391020']))
Works fine.
python 2.7.13, Anaconda 4.4.0, Ubuntu 16.04.2
Any idea what could be causing this?
From the trace it looks to me like the schematics library is your issue. Checking the open issues on the betfair github there is, as of this writing, an open ticket regarding schematics breaking the api. It would appear that the author has left schematics out of the requirements and that version 1.1.1 is required. My guess is you have schematics 2.0 installed on the computer causing the issue.
One way to find this in the future would be to pip freeze the working environment and diff the broken environment. Moreover, when moving to a new machine you can use the output of pip freeze to duplicate the environment and avoid messy version issues like this.

Selenium with python keeps on getting timedout even after I have manually set a really high timeout value

I am trying to use webdriver.Firefox() in my project. My firefox version is 54.0 and selenium version is 3.4.3.
I have tried:
driver = webdriver.Firefox()
but this gives an error message
timeout: timed out
while opening the browser in less than a second so this definitely isn't a timeout issue. I have tried manually setting the timeout as,
driver = webdriver.Firefox(timeout=100000)
Now it works fine at times but gives time out during opening browser and sometimes and sometimes gives time out while making a request even when the time taken for that request was very less, maybe around 2 seconds or less.
Is there an obvious problem here?
This is the full stacktrace
timeout Traceback (most recent call last)
/home/hackerearth/webapps/django/mycareerstack/apps/functional_tests/sprints/test_sprint_registration.py in <module>()
24
25 if __name__ == '__main__':
---> 26 unittest.main()
/usr/lib/python2.7/unittest/main.pyc in __init__(self, module, defaultTest, argv, testRunner, testLoader, exit, verbosity, failfast, catchbreak, buffer)
92 self.testLoader = testLoader
93 self.progName = os.path.basename(argv[0])
---> 94 self.parseArgs(argv)
95 self.runTests()
96
/usr/lib/python2.7/unittest/main.pyc in parseArgs(self, argv)
147 else:
148 self.testNames = (self.defaultTest,)
--> 149 self.createTests()
150 except getopt.error, msg:
151 self.usageExit(msg)
/usr/lib/python2.7/unittest/main.pyc in createTests(self)
153 def createTests(self):
154 if self.testNames is None:
--> 155 self.test = self.testLoader.loadTestsFromModule(self.module)
156 else:
157 self.test = self.testLoader.loadTestsFromNames(self.testNames,
/usr/lib/python2.7/unittest/loader.pyc in loadTestsFromModule(self, module, use_load_tests)
63 obj = getattr(module, name)
64 if isinstance(obj, type) and issubclass(obj, case.TestCase):
---> 65 tests.append(self.loadTestsFromTestCase(obj))
66
67 load_tests = getattr(module, 'load_tests', None)
/usr/lib/python2.7/unittest/loader.pyc in loadTestsFromTestCase(self, testCaseClass)
54 if not testCaseNames and hasattr(testCaseClass, 'runTest'):
55 testCaseNames = ['runTest']
---> 56 loaded_suite = self.suiteClass(map(testCaseClass, testCaseNames))
57 return loaded_suite
58
/home/hackerearth/webapps/django/mycareerstack/apps/functional_tests/sprints/test_sprint_registration.py in __init__(self, *args, **kwargs)
7
8 def __init__(self, *args, **kwargs):
----> 9 super(RegistrationLandingPageTestCase, self).__init__(*args, **kwargs)
10 user = self.get_user()
11 self.single_phase_hack = self.get_single_phase_hackathon()
/home/hackerearth/webapps/django/mycareerstack/apps/functional_tests/sprints/utils.pyc in __init__(self, *args, **kwargs)
6 def __init__(self, *args, **kwargs):
7 super(SprintFunctionalTestCase, self).__init__(
----> 8 *args, **kwargs)
9 user = self.get_user()
10 self.login(user)
/home/hackerearth/webapps/django/mycareerstack/apps/functional_tests/utils.pyc in __init__(self, *args, **kwargs)
26 def __init__(self, *args, **kwargs):
27 super(HEFunctionalTestCase, self).__init__(*args, **kwargs)
---> 28 self.browser = webdriver.Firefox(timeout=10000)
29 self.homepage = 'http://localhost:8000'
30 self.keys = Keys
/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/webdriver.pyc in __init__(self, firefox_profile, firefox_binary, timeout, capabilities, proxy, executable_path, firefox_options, log_path)
150 command_executor=executor,
151 desired_capabilities=capabilities,
--> 152 keep_alive=True)
153
154 # Selenium remote
/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.pyc in __init__(self, command_executor, desired_capabilities, browser_profile, proxy, keep_alive, file_detector)
96 warnings.warn("Please use FirefoxOptions to set browser profile",
97 DeprecationWarning)
---> 98 self.start_session(desired_capabilities, browser_profile)
99 self._switch_to = SwitchTo(self)
100 self._mobile = Mobile(self)
/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.pyc in start_session(self, capabilities, browser_profile)
186 parameters = {"capabilities": w3c_caps,
187 "desiredCapabilities": capabilities}
--> 188 response = self.execute(Command.NEW_SESSION, parameters)
189 if 'sessionId' not in response:
190 response = response['value']
/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.pyc in execute(self, driver_command, params)
252
253 params = self._wrap_value(params)
--> 254 response = self.command_executor.execute(driver_command, params)
255 if response:
256 self.error_handler.check_response(response)
/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/remote_connection.pyc in execute(self, command, params)
462 path = string.Template(command_info[1]).substitute(params)
463 url = '%s%s' % (self._url, path)
--> 464 return self._request(command_info[0], url, body=data)
465
466 def _request(self, method, url, body=None):
/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/remote_connection.pyc in _request(self, method, url, body)
486 try:
487 self._conn.request(method, parsed_url.path, body, headers)
--> 488 resp = self._conn.getresponse()
489 except (httplib.HTTPException, socket.error):
490 self._conn.close()
/usr/lib/python2.7/httplib.pyc in getresponse(self, buffering)
1134
1135 try:
-> 1136 response.begin()
1137 assert response.will_close != _UNKNOWN
1138 self.__state = _CS_IDLE
/usr/lib/python2.7/httplib.pyc in begin(self)
451 # read until we get a non-100 response
452 while True:
--> 453 version, status, reason = self._read_status()
454 if status != CONTINUE:
455 break
/usr/lib/python2.7/httplib.pyc in _read_status(self)
407 def _read_status(self):
408 # Initialize with Simple-Response defaults
--> 409 line = self.fp.readline(_MAXLINE + 1)
410 if len(line) > _MAXLINE:
411 raise LineTooLong("header line")
/usr/lib/python2.7/socket.pyc in readline(self, size)
478 while True:
479 try:
--> 480 data = self._sock.recv(self._rbufsize)
481 except error, e:
482 if e.args[0] == EINTR:
timeout: timed out

Categories

Resources