Skip to content

Conversation

@umayado17
Copy link
Contributor

Fix date format string for Windows compatibility

Problem

When running interpreter --os on Windows, the program crashes with a ValueError due to an incompatible date format string (%-d).

Solution

Changed the date format string from %-d to %d to ensure compatibility with Windows systems.

Changes

  • Modified interpreter/computer_use/loop.py to use Windows-compatible date format
  • Replaced %-d with %d in strftime() call

Testing

Tested on:

  • Windows 11
  • Python 3.11
  • open-interpreter 0.4.1

The fix allows the program to start normally with the --os flag on Windows.

Fixes #1495

- Changed %-d to %d in date format string to support Windows
- Fixes ValueError when running with --os flag on Windows
@killerapp
Copy link

Can confirm this is a blocker for Windows 11 based installs on 0.4.1

@CyanideByte
Copy link
Contributor

CyanideByte commented Oct 25, 2024

@umayado17 If you want to maintain the no leading zeros aspect you can do this instead:
{datetime.today().strftime('%A, %B %#d, %Y' if platform.system() == 'Windows' else '%A, %B %-d, %Y')}

Its such a strange python quirk.

According to the advice by CyanideByte, I modified as follows:

{datetime.today().strftime('%A, %B %#d, %Y' if platform.system() == 'Windows' else '%A, %B %-d, %Y')}
@umayado17
Copy link
Contributor Author

{datetime.today().strftime('%A, %B %#d, %Y' if platform.system() == 'Windows' else '%A, %B %-d, %Y')}

Thank you for your advice, I’ve modified the code.

@KillianLucas KillianLucas merged commit 348cec1 into openinterpreter:main Oct 26, 2024
@KillianLucas
Copy link
Collaborator

Thank you so much for this fix @umayado17. And for the reviews Cyanide @CyanideByte, @killerapp, @rohnsha0, @Angie-Star0215. Pushing to pip now. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

6 participants