Skip to content

subprocess.TimeoutExpired exception in get_version #1334

@apteronal

Description

@apteronal

Hello,

I'm using a development version of websockets for a program. Sometimes when starting the program, this exception occurs and the program fails:
subprocess.TimeoutExpired: Command '['git', 'describe', '--dirty', '--tags', '--long']' timed out after 1 seconds

Not sure why. The system is using a slow, spinning disk so I wonder if the Git command just takes longer than 1 second. Whatever the case, it seems like the exception should be handled.

Traceback:

Traceback (most recent call last):
  File "/home/apteronal/foo.py", line 6, in <module>
    import websockets
  File "/home/apteronal/development/websockets/src/websockets/__init__.py", line 4, in <module>
    from .version import version as __version__  # noqa
  File "/home/apteronal/development/websockets/src/websockets/version.py", line 68, in <module>
    version = get_version(tag)
  File "/home/apteronal/development/websockets/src/websockets/version.py", line 38, in get_version
    description = subprocess.run(
  File "/usr/lib/python3.9/subprocess.py", line 507, in run
    stdout, stderr = process.communicate(input, timeout=timeout)
  File "/usr/lib/python3.9/subprocess.py", line 1134, in communicate
    stdout, stderr = self._communicate(input, endtime, timeout)
  File "/usr/lib/python3.9/subprocess.py", line 1982, in _communicate
    self._check_timeout(endtime, orig_timeout, stdout, stderr)
  File "/usr/lib/python3.9/subprocess.py", line 1178, in _check_timeout
    raise TimeoutExpired(
subprocess.TimeoutExpired: Command '['git', 'describe', '--dirty', '--tags', '--long']' timed out after 1 seconds

I'd be glad to try to provide further information if needed. Thank you for developing this library.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions