Reputation: 759
I have an HTML page, a Python script written with Flask, and a different Python script. When I execute the script written with Flask, I can go to 127.0.0.1:12345 and see my HTML page. I have a button set up on the HTML page that sends data in text boxes to the script written in Flask to examine. I have a function in my Flask script that executes when the button is clicked and it obtains data from the HTML page's text boxes. When I try to call my other script from this function (The other script is called users.py. So I would say, "users.main(args)".) the users.main doesn't execute. I have this set up:
try:
users.main(['-h'])
except:
print 'OH NO'
And it prints OH NO in the terminal I call the main script in. Why does it completely fail? It doesn't produce any errors.
Upvotes: 1
Views: 2671
Reputation: 33319
Run users.main(['-h']) without try/catch and see what happens. The error/stacktrace would probably give you an indication of what's going on.
Upvotes: 1
Reputation: 3009
Why not import the python file and the execute the function instead of calling the script itself? (that's what it seems to me like you're doing...)
You're not getting an error message because you catch the exception. You can remove the try/except and have python go ahead and print out what's wrong.
You could also take a look at the python traceback module which will let you analyze exceptions and whatnot. It's hard to help you anymore because we don't know what your code is.
Upvotes: 4