I'm running a python 2.7 program using Terminal, on a Mac. If I open up Terminal and run the program, it executes differently from when I run the program a second time, in the same Terminal window. What could possibly cause a problem like this?
Below is the code I'm using. The line print bg("grey_50")
prints nothing on the first program execution, but it correctly prints a grey line on the second execution. On BOTH executions, the for
function operates the same, and correctly. Why does the grey line only print the second time I run the program?
uses_color = "True"
if uses_color == "True":
from colored import fg, bg
if uses_color == "True":
print bg("grey_50")
for i in range(44):
print bg("grey_100")
As a side note, there is also some code between the second and third stanzas that works the same, and correctly, every time I run the function.
Additionally, please observe that both the line print bg("grey_50")
and print bg("grey_100")
use the colored module, but only the latter of those two works consistently.
Link to colored: https://github.com/dslackw/colored