Skip to content

Hardcoded /tmp/ paths in config break Windows compatibility (Need your help) #37

Open

Description

@Devguru-codes

Location

package/src/pyaslreport/core/config/allowed_file_types.yaml

Description

All intermediate file paths use /tmp/ which doesn't exist on Windows. This breaks cross-platform compatibility. Should use tempfile.gettempdir() or os.path.join(tempfile.gettempdir(), ...).

Status

I need your guidance in — whether this should be a YAML-level or Python-level fix (config values vs runtime resolution).

An advice towards the goal is what I need.
Thank you

Activity

  1. Saad-Mallebhari commented on Mar 5, 2026

    @Saad-Mallebhari

    @Devguru-codes
    Good catch. The fix should be at the Python level, not the YAML level.

    Here's why: YAML is a static config file , it can't evaluate tempfile.gettempdir() at runtime. If you hardcode a path in YAML, it's still hardcoded. The resolution needs to happen in the Python code that reads those config values.

    The recommended approach is to remove the hardcoded /tmp/ paths from the YAML entirely and replace them with just the filename or a relative placeholder. Then resolve the full platform-appropriate temp path during config loading:

    import os
    import tempfile
    
    def resolve_temp_path(filename: str) -> str:
        return os.path.join(tempfile.gettempdir(), filename)

    This way the YAML stays portable and platform-specific path resolution happens in one place during config loading , rather than being scattered across wherever paths are consumed.

    tempfile.gettempdir() returns the correct temp directory on all platforms (/tmp on Linux/macOS, C:\Users\...\AppData\Local\Temp on Windows), so this approach handles cross-platform compatibility cleanly without any platform checks.

  2. added a commit that references this issue on Mar 23, 2026
    5822b6c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    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