open-interpreter icon indicating copy to clipboard operation
open-interpreter copied to clipboard

Fix: Change date format string for Windows compatibility

Open umayado17 opened this issue 1 year ago • 3 comments

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

umayado17 avatar Oct 24 '24 12:10 umayado17

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

killerapp avatar Oct 24 '24 15:10 killerapp

@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.

CyanideByte avatar Oct 25 '24 23:10 CyanideByte

{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.

umayado17 avatar Oct 26 '24 00:10 umayado17

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

KillianLucas avatar Oct 26 '24 03:10 KillianLucas