title: os.mkdir() and os.makedirs() fail to create directory inside /tmp yet no exception is raised
body: <p>Using <strong>Python 2.7</strong> on 32bit <strong>Xubuntu 14.04 LTS</strong></p>
  
  <p>I'm struggling with this issue for two days now. So far I have tried using <code>umask</code>, <code>chmod</code> and what not. The results is always the same - failure to create a directory.</p>
  
  <p>Here is a snippet from my application:</p>
  
  <pre><code>def checkRootDirExists(self):
      '''
      Check if the process folder is present and create it if not
      '''
      if not exists(self.dir_name): # Using os.path.exists()
        rospy.loginfo('SR2: Process directory "%s" doesn\'t exist and therefore will be created', (self.dir_name+'/'))
        try:
          mkdir(self.dir_name)
        except OSError as e:
          if e.errno != errno.EEXIST:
            rospy.logerr('Directory exists')
          elif e.errno != errno.EACCES:
            rospy.logerr('Access violation')
          else:
            rospy.logerr('Something else happened')
      else:
        rospy.loginfo('SR2: Process directory "%s" already exists', (self.dir_name+'/'))
  </code></pre>
  
  <p><strong>Note:</strong> rospy is part of the Python API of ROS (Robot Operating System). You can view it as a simple <code>print()</code> statement (it's basically exactly that but has the formatting of <code>printf()</code> from C/C++).</p>
  
  <p>The output is as follows:</p>
  
  <pre><code>[INFO] [WallTime: 1455985284.031136] SR2: Process directory "/tmp/rosrunlttalkerpy/" doesn't exist and therefore will be created
  </code></pre>
  
  <p><strong>Note:</strong> Don't forget that the <code>/</code> at the end is only added for the output. Internally it is <code>/tmp/rosrunlttalkerpy</code></p>
  
  <p>I have added the exception cases separately just to see where the problem is coming from. The thing is...No exception gets raised hence none of the print statements are displayed. This wouldn't be a problem if the folder actually was created which is not the case here. I have tried the generic way of handling an exception using <code>except Exception</code> along with several other more specific error types that I thought might give me some feedback. Same result - nothing.</p>
  
  <p>My <code>self.dir_name</code> is an automatically generated string using things like launch command (<code>roslaunch</code>, <code>rosrun</code> etc.), package and node name. I have made sure that it's a valid string. As an example the following is one of the values I generate:</p>
  
  <pre><code># launch command: rosrun
  # package: lt
  # node: listener.py
  /tmp/rosrunltlistenerpy
  </code></pre>
  
  <p>My user has <code>sudo</code> privileges however in this case this is not important since:</p>
  
  <ul>
  <li>I run my ROS in normal user space</li>
  <li>The <strong>write</strong> and <strong>read</strong> permissions to <code>/tmp</code> even though owned by <code>root</code> are okay for all three types of users (<code>owner</code>, <code>group</code> and <code>others</code>). </li>
  </ul>
  
  <p>At first I thought that there was something fishy going on with <code>/tmp</code> itself. However I have also tried <code>~</code> yet the result is the same - no error, no directory.</p>
  
  <p>The next thing I thought I might try is to use the interactive interpreter. So I started it and used <code>mkdir()</code> with the same path as in my code above. A directory was created!</p>
  
  <pre><code>&gt;&gt;&gt; dir_name = '/tmp/rosrunltlistenerpy'
  &gt;&gt;&gt; if exists(dir_name): print('Dir exists!')
  ... else:
  ...   try:
  ...     mkdir(dir_name)
  ...   except OSError as e:
  ...     print('Something went wrong')
  
  RESULT: rosrunltlistenerpy directory created inside /tmp
  </code></pre>
  
  <p>Further I have another function called <code>cleanup()</code> which basically removes the created directory along with all files in it.</p>
  
  <pre><code>def cleanup(self):
      '''
      Removes all files related to the external process: .proc, .bash and root directory containing these two files
      '''
      try:
        # Sometimes rmtree may fail
        rmtree(self.dir_name)
      except:
        # in which case we can simply remove the separate files one by one
        try:
          remove(self.proc_path)
          remove(self.bash_path)
          rmdir(self.dir_name)
        except:
          if self.bash_pid or self.proc_pid:
            self.proc_status = ProcStatus.FAILED_STOP
          self.statusSignal.emit(self.proc_status)
  </code></pre>
  
  <p>The funny thing is that this actually works. So for some reason creation of a directory from withing my application fails SILENTLY yet deleting of that same directory (if I have created it externally like when using the interactive interpreter) works fine. This makes no sense at all. Any ideas what might be the reason for this strange behaviour?</p>
  
  <p><strong>EDIT2:</strong></p>
  
  <p>I have added a print (in my case <code>loginfo()</code>) right after <code>mkdir()</code> inside the <code>try</code>'s body and it appears on the screen. This would mean that indeed no exception is raised.</p>