title: Global name __file__ is not defined?
body: <p>I'm bukkit plugin coder and I'm stuck on making config file. I want to use <code>__file__</code> to locate current directory of .py file... I was googling and saw <code>sys.argv[0]</code>, but as I see, it's only for Windows users, I want it to be compatible for every OS, if I'm wrong, can you provide me example of it?</p>
  
  <p>Here's my code:</p>
  
  <pre><code>def onEnable(self):
      pluginlokacija1 = os.path.realpath(__file__)
      if os.path.isfile("%s/Halloween/config.yml"%pluginlokacija1):
          pass
      else:
          os.mkdir("%s/Halloween/"%pluginlokacija1)
          self.createConfig()
          self.findFolder()
          self.cfg = YamlConfiguration.loadConfiguration(File(os.path.join(self.folder,"config.yml")))
          itemlist = self.cfg.getString("main.itemlist")
          print ("Rezultat: %s" % itemlist)
  
  def createConfig(self):
      pluginlokacija2 = os.path.realpath(__file__)
      fo = open("%s/Halloween/config.yml"%pluginlokacija2, "wb")
      fo.write( "main:\n itemlist: 172\n candydropchance: 50");
      fo.close
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>14:54:06 [SEVERE] Error occurred while enabling Halloween v1.0 (Is it up to date
  ?): null
  Traceback (most recent call last):
  File "&lt;iostream&gt;", line 70, in onEnable
  NameError: global name '__file__' is not defined
  </code></pre>
  
  <p>Thanks for answering! :)</p>