1
0
mirror of https://github.com/Tygs/0bin.git synced 2023-08-10 21:13:00 +03:00
Files
0bin/zerobin
Mike Kazantsev 04f44debaf Use runpy.run_path() or execfile() instead of import machinery for --settings-file.
Problem with import is that it:

 - Reuses already-imported module.

  For example, --settings-file=/etc/zerobin.py won't be imported,
  because sys.modules will already contain 'zerobin' entry.

 - Alters sys.path.

  Importing module from a heavily-populated directory may potentially
  cause next imports to run code from totally unexpected places.

Using execfile() doesn't set some globals like __file__ as import does,
which has to be done manually.
It also might be a bit slower for large body of code in settings file.

runpy.run_path() can only be used on python-2.7, but does not seem
to have any downsides.
2013-04-23 12:24:29 +06:00
..
2013-03-03 16:27:39 +00:00
2013-01-24 10:59:25 +01:00
2013-03-19 12:02:30 +01:00
2013-03-03 16:27:39 +00:00