Skip to content

Error when --doc or --metadata value matches an existing directory #4394

Closed

Description

@lesnake

Let say that I have a directory named pekka, running
robot --metadata dev:pekka any.robot
will fail with message :
[ ERROR ] Reading documentation from an external file failed: [Errno 21] Is a directory: 'pekka'

The same happens with -D pekka

I think the issue comes from this line :
if os.path.exists(value):
line 143 in src/robot/conf/settings.py, which should be :
if os.file.exists(value):
which will filter out directories to reach the failing open/read.

Issue related for sure with #4008

Activity

  1. added this to the v5.1 milestone on Jul 11, 2022
  2. pekkaklarck commented on Jul 11, 2022

    @pekkaklarck
    Member

    Yeah, should use os.path.isfile instead of os.path.exists.

  3. pekkaklarck commented on Jul 12, 2022

    @pekkaklarck
    Member

    This isn't too severe because with documentation it's unlikely your doc is only a directory name and with metadata there's a possibility to use any path as a value if there's a space after the colon like -metadata dev: pekka. Definitely worth fixing anyway.

  4. changed the title [-]Error when metadata/documentation value matches an existing directory[/-] [+]Error when `--doc` or `--metadata` value matches an existing directory[/+] on Jul 12, 2022
  5. added theissue type on Dec 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions