title: "Permission Denied" in python copying files from jenkins, but not from shell
body: <p>I have a script in python which get one path with OptionParser and copy the file in that path to another path with timestamp+name using shutil.copy.</p>
  
  <p>When I launch the script from shell, everything works fine. But when Jenkins launches the script, I get the following exception:</p>
  
  <pre><code>Traceback (most recent call last):
    File "/home/helper/add_file.py", line 101, in &lt;module&gt;
      uploader.run()
    File "/home/helper/add_file.py", line 80, in run
      shutil.copy(self.filename,destination_path+disk_filename)
    File "/usr/lib/python2.7/shutil.py", line 119, in copy
      copyfile(src, dst)
    File "/usr/lib/python2.7/shutil.py", line 83, in copyfile
      with open(dst, 'wb') as fdst:
  IOError: [Errno 13] Permission denied: u'/home/blabla/destinationfolder/1399362213.01file.apk'
  </code></pre>
  
  <p>With whoami and pwd I recreate the execution in shell with the same user (tomcat7) and from the same location (jenkins project workspace) and there is no permission denied problem, user tomcat7 has full writing permission in destination directory and the source directory... </p>
  
  <p>So, why with the same user and using the same destination and source path, from the shell everything works fine and executing from Jenkins I get this "Permission Denied" exception?</p>
  
  <p><strong>UPDATED</strong></p>
  
  <p>I tested the user with getpass.getuser() and the result is the same in jenkins and in the shell (tomcat7).</p>
  
  <p>I changed the permisions from 775 to 777 and then I can write at the directory... But this is not a solution because I dont want give write permissions to all. The user tomcat7 is in the group who has permission to write the folder so... It's like Jenkins is ignoring the groups from the user tomcat7 (I checked the /etc/group file and tomcat7 is in the group with permissions)</p>