Reputation: 434
While trying to run the following code from django application's views
Code: views.py
def tika(fileName):
os.popen('java -jar tika-app.jar -t %s > textOutput.txt' % fileName)
return 0
....
# filepath == path to a file
# call java applications
tika(filepath)
....
I get the following error messages:
Error: Unable to access jarfile tika-app.jar
I feel that it has something to do with file permissions for django application, but this is just my guess.
If it might help to know - the java application is in the same directory as the django app.
Upvotes: 4
Views: 2492
Reputation: 434
Found the part that was causing the problem:
The java application should be in the Django's project directory level and not at the Django's application directory level.
Lesson from this: Even though the running code (views.py) is in the Django's application level, it is run from one level up - the project level.
Upvotes: 6