I am running the script with python setup.py
script is in this folder:
/data/jenkins/pypi/fabundle_env/fa-bundle/base
One folder above I have a Readme.Md file which content I need to reed.
import os
fname="Readme.Md"
print (os.path.join(os.path.dirname((os.path.dirname(os.path.abspath(__file__))))), fname)
def read(fname):
return open((os.path.join(os.path.dirname((os.path.dirname(os.path.abspath(__file__))))), fname)).read()
long_description=read('Readme.Md')
Output:
/data/jenkins/pypi/fabundle_env/fa-bundle Readme.Md
Traceback (most recent call last):
File "setup.py", line 22, in <module>
long_description=read('Readme.Md'),
File "setup.py", line 14, in read
return open((os.path.join(os.path.dirname((os.path.dirname(os.path.abspath(__file__))))), fname)).read()
TypeError: expected str, bytes or os.PathLike object, not tuple
For implementation purposes I have read os.path.join(os.path.dirname(__file__)) returns nothing but I had to use abspath
in order to get some result.
Thanks