Skip to content

Date format string error on Windows when using --os flag #1495

@umayado17

Description

@umayado17

Describe the bug

I encountered an error when running interpreter --os on Windows. The error occurs due to an incompatible date format string.

Environment

  • OS: Windows
  • Python version: 3.11
  • open-interpreter version: 0.4.1

Error Message

ValueError: Invalid format string

Error Location

The error occurs in interpreter\computer_use\loop.py, where the date format string uses %-d which is not supported on Windows.

Current code:

datetime.today().strftime('%A, %B %-d, %Y')

## Solution
Changing %-d to %d fixes the issue. This suggests that the code should handle platform-specific date formatting.

## Suggestion
Consider using one of these approaches to fix this cross-platform issue:

Use %d instead of %-d
Add platform-specific handling for date formatting
Use a cross-platform date formatting library

This would improve the Windows user experience with open-interpreter.

### Reproduce

1. Run `pip install open-interpreter`
2. Run `interpreter --os`
3. The error occurs due to incompatible date format string
4. Error message shows: ValueError: Invalid format string

### Expected behavior

The program should start normally without any date format errors when using the --os flag on Windows.

### Screenshots

![image](https://github.com/user-attachments/assets/4ffc3a11-78e4-48d5-b44b-9b384a54bd36)


### Open Interpreter version

0.4.1

### Python version

3.11

### Operating System name and version

Windows 11

### Additional context

_No response_

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