title: Flask - Errno 13 premission denied
body: <p>I'm writing a small web page whose task is to let a user upload his input file and with uploading I want to execute my calculation program in python which will give me output for the user.</p>
  
  <p>My code looks like this:</p>
  
  <pre><code>import os
  import os.path
  import datetime
  import subprocess
  from flask import Flask, render_template, request, redirect, url_for
  from werkzeug import secure_filename
  
  app = Flask(__name__)
  app.config['UPLOAD_FOLDER'] = 'uploads'
  app.config['ALLOWED_EXTENSIONS'] = set(['txt', 'gro', 'doc', 'docx'])
  
  current_time = datetime.datetime.now()
  file_time = current_time.isoformat()
  proper_filename = file_time
  
  def allowed_file(filename):
      return '.' in filename and \
             filename.rsplit('.', 1)[1] in app.config['ALLOWED_EXTENSIONS']
  
  def run_script():
      subprocess.call(['/home/martyna/Dropbox/programowanie/project_firefox/topologia.py', '/uploads/proper_filename'])
  
  @app.route('/')
  def index():
      return render_template('index.html')
  
  @app.route('/upload', methods = ['POST'])
  def upload():
      file = request.files['file']
      if file and allowed_file(file.filename):
          file.save(os.path.join(app.config['UPLOAD_FOLDER'], proper_filename))
          run_script().start()
          return "Thank you for uploading"
  
  
  if __name__ == '__main__':
      app.debug = True
      app.run(host='0.0.0.0')
  </code></pre>
  
  <p>Uploading goes well, but the problem is that when I hit upload I get message <code>OSError: [Errno 13] Permission denied</code> and the line causing the problem is:</p>
  
  <pre><code>subprocess.call(['/home/martyna/Dropbox/programowanie/project_firefox/topologia.py', '/uploads/2014-05-16T22:08:19.522441'])
  </code></pre>
  
  <p>program topologia.py runs from command <code>python topologia.py input_file</code></p>
  
  <p>I have no idea how to solve that problem.</p>