Rename cdist.py to scripts/cdist to avoid self import

naming cdist cdist.py and running import cdist, imports itself and thus raises an interesting error:

(virtualenv)[7:47] brief:virtualenv% cdist.py
Traceback (most recent call last):
  File "<frozen importlib._bootstrap>", line 1512, in _find_and_load_unlocked
AttributeError: 'module' object has no attribute '__path__'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/users/nico/oeffentlich/rechner/projekte/cdist/virtualenv/bin/cdist.py", line 230, in <module>
    commandline()
  File "/home/users/nico/oeffentlich/rechner/projekte/cdist/virtualenv/bin/cdist.py", line 27, in commandline
    import cdist.banner
ImportError: No module named 'cdist.banner'; cdist is not a package

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/users/nico/oeffentlich/rechner/projekte/cdist/virtualenv/bin/cdist.py", line 235, in <module>
    except cdist.Error as e:
AttributeError: 'module' object has no attribute 'Error'

Also described on

    http://www.velocityreviews.com/forums/t953596-error-executing-import-html-parser-from-a-script.html

Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
This commit is contained in:
Nico Schottelius 2012-10-30 11:47:16 +01:00
parent a81525b101
commit 10b6c31ac8
2 changed files with 4 additions and 1 deletions

View File

@ -22,5 +22,8 @@
# Wrapper for real script to allow execution from checkout # Wrapper for real script to allow execution from checkout
dir=${0%/*} dir=${0%/*}
# Ensure version is present - the bundled/shipped version contains a static version,
# the git version contains a dynamic version
"$dir/../build" version "$dir/../build" version
"$dir/../cdist.py" "$@" PYTHONPATH="${dir}/../" "$dir/../scripts/cdist" "$@"