Skip to content

PermissionError not defined in Python 2.7 #3652

Closed
@richardliaw

Description

@richardliaw

System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Ubuntu 16
  • Ray installed from (source or binary): binary
  • Ray version: 0.6.1
  • Python version: 2.7
  • Exact command to reproduce:

I don't have access to /tmp, and I get this following error:

cluster_tests.py:55: in _start_new_cluster
    "num_heartbeats_timeout": 10
/data/rliaw/miniconda3/envs/py2/lib/python2.7/site-packages/ray/test/cluster_utils.py:43: in __init__
    self.add_node(**head_node_args)
/data/rliaw/miniconda3/envs/py2/lib/python2.7/site-packages/ray/test/cluster_utils.py:86: in add_node
    **node_kwargs)
/data/rliaw/miniconda3/envs/py2/lib/python2.7/site-packages/ray/services.py:1777: in start_ray_head
    _internal_config=_internal_config)
/data/rliaw/miniconda3/envs/py2/lib/python2.7/site-packages/ray/services.py:1436: in start_ray_processes
    redis_max_memory=redis_max_memory)
/data/rliaw/miniconda3/envs/py2/lib/python2.7/site-packages/ray/services.py:458: in start_redis
    redis_stdout_file, redis_stderr_file = new_redis_log_file(redirect_output)
/data/rliaw/miniconda3/envs/py2/lib/python2.7/site-packages/ray/tempfile_services.py:182: in new_redis_log_file
    "redis", redirect_output)
/data/rliaw/miniconda3/envs/py2/lib/python2.7/site-packages/ray/tempfile_services.py:166: in new_log_files
    try_to_create_directory("/tmp/ray")
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

directory_path = '/tmp/ray'

    def try_to_create_directory(directory_path):
        """Attempt to create a directory that is globally readable/writable.

        Args:
            directory_path: The path of the directory to create.
        """
        directory_path = os.path.expanduser(directory_path)
        if not os.path.exists(directory_path):
            try:
                os.makedirs(directory_path)
            except OSError as e:
                if e.errno != os.errno.EEXIST:
                    raise e
                logger.warning(
                    "Attempted to create '{}', but the directory already "
                    "exists.".format(directory_path))
            # Change the log directory permissions so others can use it. This is
            # important when multiple people are using the same machine.
        try:
            os.chmod(directory_path, 0o0777)
>       except PermissionError:
E       NameError: global name 'PermissionError' is not defined

/data/rliaw/miniconda3/envs/py2/lib/python2.7/site-packages/ray/tempfile_services.py:69: NameError

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions