Forums

Unable to Execute Script externally from Flask

okay so here's my project structure (https://ibb.co/kAetBJ). The problem is that I want to execute Indi.py from route.py (as this is the driver program of my web application). Indi.py generates CSV(s) files. When I execute indi.by individually it works perfectly fine. But when I try to execute it through route.py it fails. Secondly, when I visit the Link to my web app it works fine but doesn't actually creates the CSV. I'm stuck on this problem from several days tried all threads but none of them worked fine. [Tried os, subprocess, exec, import]

All Suggestions are welcome.

Edit: Indi.py extracts data from Twitter and saves them into CSV.

You're probably using relative paths without paying attention to what your working directory is. Use absolute or calculated paths as described here: http://help.pythonanywhere.com/pages/NoSuchFileOrDirectory/