Python Config.cfg - why isnt Python picking though

2019-09-18 16:25发布

问题:

I have imgprocessor.py where I have included a folder config as in:

When I try to use the file in the context of the folder i.e. if i execute the same from python imgprocessor.py -f 'nasa.jpg' etc, the config file resolves. When I install the above package using python setup.py install, then later use a different python program and use it, the file is not being picked. It says cant find config file. I am using the same as per the recommendation of using through os.realpath and usage of __file__, but still not able to resolve when used as package from different programs but works within the file of program