Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix "Invalid format string" in Windows #55

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix "Invalid format string" in Windows
ValueError: Invalid format string

%l is not standard: %l - Hour of the day, 12-hour clock, blank-padded ( 1..12)

The Windows implementations doesn't support it:
https://msdn.microsoft.com/en-us/library/fe06s4ak.aspx
https://docs.python.org/3/library/time.html

Use %I instead: %I - Hour of the day, 12-hour clock, zero-padded (01..12)
  • Loading branch information
raulsiles authored Sep 30, 2017
commit cdfe751951939a1d149c744ec3591eb76ae9d4a4
4 changes: 2 additions & 2 deletions appmon.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def on_detached():
print colored('[WARNING] "%s" has terminated!' % (app_name), 'red')

def on_message(message, data):
current_time = time.strftime('%b %d %Y %l:%M %p', time.localtime())
current_time = time.strftime('%b %d %Y %I:%M %p', time.localtime())
global output_dir
if not os.path.exists(output_dir):
os.makedirs(output_dir)
Expand Down Expand Up @@ -357,4 +357,4 @@ def init_session():
except KeyboardInterrupt:
script.unload()
session.detach()
_exit_()
_exit_()