roryk / ipython-cluster-helper

Tool to easily start up an IPython cluster on different schedulers.
148 stars 23 forks source link

added catch for basestring type, which was removed in python 3 #39

Closed mdeboth closed 8 years ago

mdeboth commented 8 years ago

Thanks, @peteut for #38. I was just hitting this one small error when running Python 3. Please edit the pull request if there's a more appropriate fix.

Traceback (most recent call last):
  File "test.py", line 6, in <module>
    extra_params={"run_local": False}) as view:
  File "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/contextlib.py", line 59, in __enter__
    return next(self.gen)
  File "/Users/mdeboth/Desktop/ipptest/lib/python3.5/site-packages/cluster_helper/cluster.py", line 1065, in cluster_view
    wait_for_all_engines=wait_for_all_engines)
  File "/Users/mdeboth/Desktop/ipptest/lib/python3.5/site-packages/cluster_helper/cluster.py", line 952, in __init__
    _start(scheduler, self.profile, queue, num_jobs, cores_per_job, self.cluster_id, extra_params)
  File "/Users/mdeboth/Desktop/ipptest/lib/python3.5/site-packages/cluster_helper/cluster.py", line 825, in _start
    resources, specials = _scheduler_resources(scheduler, extra_params, queue)
  File "/Users/mdeboth/Desktop/ipptest/lib/python3.5/site-packages/cluster_helper/cluster.py", line 783, in _scheduler_resources
    if isinstance(orig_resources, basestring):
NameError: name 'basestring' is not defined
peteut commented 8 years ago

Good catch, alternatively you could use six.string_types.

roryk commented 8 years ago

Thanks for catching this and the fix, Matt and Alain,

Could you swap it to use six.string_types without the try/except? It looks like that is the idiomatic way to do it.

mdeboth commented 8 years ago

Closing this in favor of #40. Thanks!