title: How to execute a python file (.py) on hadoop distributed file system (hdfs)
body: <p>Hadoop offers the possibility to run java applications directly on the cluster using </p>
  
  <pre><code>hadoop jar &lt;jar&gt;
  </code></pre>
  
  <p>Now I have a python script instead of a java application.</p>
  
  <p>Below is the construct of the .py file without the all the functionality, just left the "remove-files-from-folder" part </p>
  
  <pre><code>import os.path
  
  def transform():
      inputfolder = "input"
      for filename in os.listdir(inputfolder):
          path = inputfolder + "\\" + filename
          os.remove(path)
  def main():
      transform()
  if __name__ == "__main__":  main()
  </code></pre>
  
  <p>Is there a way to execute the .py file similarly to the way I'd execute a .jar file?</p>
  
  <p>I'm new to Python and Hadoop. If my approach seems totally off and doesn't make sense, I'm happy for any kind of clarification!</p>