Local environment: Python 3, Bottle, MacOs
Remote environment: Python 3, Bottle, Pythonanywhere
This works in my local environment but not in my remote environment:
@route('/test')
def test():
'''Function tests file open issue.'''
with open('uploads/Project2.csv', 'r', newline='') as file:
content = ""
content = file.read()
return content
This works in my remote environment but not in my local environment:
@route('/test')
def test():
'''Function tests file open issue.'''
with open('uploads', 'r', newline='') as file:
content = ""
content = file.read()
return content
In the first case, I pass a file path to the open function. If I pass a folder name to it returns this error:
IsADirectoryError: [Errno 21] Is a directory: 'uploads'
In the second case, I pass a folder name to the open function. If I pass a file path it returns error:
NotADirectoryError: [Errno 20] Not a directory: 'uploads/Project2.csv'
I am baffled. Any ideas?