Skip to content

Instantly share code, notes, and snippets.

@m3adow
Last active May 12, 2020 03:48
Show Gist options
  • Save m3adow/f83dcd369731c297d3dc68a62664841a to your computer and use it in GitHub Desktop.
Save m3adow/f83dcd369731c297d3dc68a62664841a to your computer and use it in GitHub Desktop.
import json
import argparse
from time import sleep
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument('input_file', metavar='INPUT')
parser.add_argument('output_file', metavar='OUTPUT')
return parser.parse_args()
args=parse_args()
while True:
try:
with open(args.input_file) as myinput:
myjson = json.load(myinput)
with open(args.output_file, 'w') as myoutput:
myoutput.write("%s - %s" % (myjson['song']['artist'], myjson['song']['title']))
except FileNotFoundError as e:
print("Couldn't find file '%s'" % e)
sleep(10)
@EpicLPer
Copy link

Traceback (most recent call last): File "C:\Users\epicl\Desktop\artist_info_pvfm.py", line 21, in <module> except FileNotFoundError as e: NameError: name 'FileNotFoundError' is not defined

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