Forums

changing a file without console

Hello, I am new to this place, here is my problem: this is a part of my code which has the problem:

f = open('example_test.py', 'a')
f.write(flask.request.form.get('text'))
f.close()

It works fine with pycharm in my computer. But it doesn't work when a user uses it. I use flask and send some data entered by the user. what is the problem? does it need a root access or something?

P.S: my python files in my computer are the same as in my account in here, and it worked on localhost:5000

What errors do you see in the error log? You'll find links to the log files in the Web page.

I see some errors from yesterday, which I have solved them before posting my problem, I see no errors from today, right after I tested it again and it still didn't work

OK I have realized why this happened and fixed it, the problem was it was saving the file in /parham123/ not in /parham123/mywebsite/ <br> thank you. I have another question, Is there a way to auto reload the site when anything changes? <br> it seems app.run(debug=True) doesn't work

Great! Glad you worked out the issue with the file.

app.run is code that runs the Flask development server, which is not used on PythonAnywhere because we have production servers that execute your code. That is why it does not reload automatically - you need to choose when to reload by clicking the button.