Quantcast
Channel: Active questions tagged config - Stack Overflow
Viewing all articles
Browse latest Browse all 5049

Python - configuration file

$
0
0

I have code:

import matplotlib.pyplot as plt
from configparser import ConfigParser  
cfg = ConfigParser()
cfg.read('file.cfg')    
plt.plot([1, 10],[2, 2], color_4, ls = "dashed")   
plt.xlim(1,10)
plt.ylim(1,4)
plt.savefig('image.pdf')

and I would like control it by configuration file:

[a]
color_4 = c = 'silver'

What is wrong please? It gives an error:

NameError: name 'color_4' is not defined

Viewing all articles
Browse latest Browse all 5049

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>