title: An OSX application I wrote says "Permission Denied" when downloaded from internet
body: <p>I have created an application for OSX that I intend to distribute by download of an .app file from my website. The problem is that when the file is downloaded, then executed it stalls and the console says "sh: : Permission Denied"</p>
  
  <p>This <strong>does not</strong> happen if the file is copied to other computers through a flash drive or CD and everything works fine.</p>
  
  <p>What is happening and how can I overcome the error so that I can distribute the program through my website? It must be some OSX precautionary measures for programs downloaded from the web?!
  What works is "sudo open -a" from terminal but that's not good enough for a user-friendly distribution. This step is not necessary unless the file comes from the web.</p>
  
  <p>Things I have tried: multiple OSX systems, changing privelages to "read and write" in Get Info of the file, placing the file in different locations</p>
  
  <p>EDIT: After going through lots of documentation and google searches I have now solved this issue. The problem was execution of files contained in the .app folder. This function is apparently restricted when OSX cannot identify the developer of the file downloaded from the internet. To solve this, I added</p>
  
  <pre><code>os.chmod(&lt;file_directory&gt;,0777)
  </code></pre>
  
  <p>where 
      '&lt;'file_directory'>'
  was the path to any file that is or could be executed by my program and is contained in the .app folder.</p>
  
  <p>The program was written in Python 2.7.</p>