Skip to content

Commit 2f902ce

Browse files
committed
Fix UTF8
1 parent c743de6 commit 2f902ce

4 files changed

+19
-15
lines changed

algorithmia_RGB2ColorName_v05.py

+8-4
Large diffs are not rendered by default.

rgb_combined_v05.csv.txt

+1-1
Large diffs are not rendered by default.

rgbcsv2colordict.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def program(*args):
2525
except IndexError: # getopt.GetoptError:
2626
# print "Usage: " + sys.argv[0] + ' -i <inputfile> -o <outputfile>'
2727
# sys.exit(2)
28-
file_in = 'rgb_combined_v03.csv'
28+
file_in = 'rgb_combined_v05.csv'
2929

3030
# Exit if file_in not found:
3131
if os.path.exists(file_in) and os.access(file_in, os.R_OK):
@@ -62,14 +62,14 @@ def program(*args):
6262
with open(file_in, 'rU') as f:
6363
reader = csv.reader(f, delimiter=',')
6464
first_line = f.readline() # pull out first line - do not print
65-
print(" HexNameDict = {",end="") # no NewLine
65+
print(" HexNameDict={",end="") # no NewLine
6666
# Loop through lines in input to generate: "[222,43,221],[2,11,222]", one for each color:
6767
rownum=0
6868
for i in reader:
6969
strRGBHex=i[0]
7070
if rownum ==0:
7171
# print first row without a comma:
72-
print(' "'+i[0]+'":"'+i[4]+'"',end="")
72+
print( '"'+i[0]+'":"'+i[4]+'"',end="")
7373
lastRGBHex=strRGBHex
7474
rownum=rownum+1
7575
else:
@@ -89,4 +89,4 @@ def program(*args):
8989
sys.stdout = stdout # Restore regular stdout.
9090
print(footer_row1)
9191
elapsed = timeit.default_timer() - start_time # End timer:
92-
print("# "+ time.strftime('%Y-%m-%d %H:%M (local time)') +' '+ sys.argv[0] +" END: ran for "+ "{:.2f}".format(elapsed * 1000 )+ ' secs.')
92+
print("# "+ time.strftime('%Y-%m-%d %H:%M (local time)') +' '+ sys.argv[0] +" END: ran for "+ "{:.2f}".format(elapsed * 1000 )+ ' secs.')

rgbcsv2rgbarray.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ def program(*args):
3232
with open(file_in, 'rU') as f:
3333
reader = csv.reader(f, delimiter=',')
3434
for i in reader:
35-
header_rows = '# '+time.strftime('%Y-%m-%d-%H:%M (local time)')+" "+sys.argv[0]+' START: outrowcount='+ str( sum(1 for _ in f) ) +'.'
35+
header_rows = '# '+time.strftime('%Y-%m-%d %H:%M (local time)')+" "+sys.argv[0]+' START: outrowcount='+ str( sum(1 for _ in f) ) +'.'
3636
print(header_rows)
3737
else:
38-
print('# '+time.strftime('%Y-%m-%d-%H:%M (local time)')+' '+sys.argv[0]+" ABORTED. Either file "+file_in+" is missing or is not readable.")
38+
print('# '+time.strftime('%Y-%m-%d %H:%M (local time)')+' '+sys.argv[0]+" ABORTED. Either file "+file_in+" is missing or is not readable.")
3939
exit(2)
4040

4141
# Provide default file_out name argument if not provided:
@@ -80,13 +80,13 @@ def program(*args):
8080
rownum=rownum+1
8181
print("])") # with NewLine
8282

83-
footer_rows=" # "+ time.strftime('%Y-%m-%d-%H:%M (local time)') +' '+ sys.argv[0] +" Output "+ str(rownum)+ ' rows.'
84-
print(footer_rows)
83+
footer_rows="# "+ time.strftime('%Y-%m-%d %H:%M (local time)') +' '+ sys.argv[0] +' '+ file_out+" output "+ str(rownum)+ ' rows.'
84+
print(' '+footer_rows)
8585
# Close the file every time:
8686
sys.stdout.close()
8787

8888
sys.stdout = stdout # Restore regular stdout.
8989
# End timer:
9090
elapsed = timeit.default_timer() - start_time
91-
print("# "+ time.strftime('%Y-%m-%d-%H:%M (local time)') +' '+ sys.argv[0] +" END: ran for "+ "{:.2f}".format(elapsed * 1000 )+ ' secs.')
92-
print(' '+footer_rows)
91+
print("# "+ time.strftime('%Y-%m-%d %H:%M (local time)') +' '+ sys.argv[0] +" END: ran for "+ "{:.2f}".format(elapsed * 1000 )+ ' secs.')
92+
print(footer_rows)

0 commit comments

Comments
 (0)