From 10b6c31ac8d14cec11e615827981ac0f49de8258 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 30 Oct 2012 11:47:16 +0100 Subject: [PATCH] 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 "", 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 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 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 --- bin/cdist | 5 ++++- cdist.py => scripts/cdist | 0 2 files changed, 4 insertions(+), 1 deletion(-) rename cdist.py => scripts/cdist (100%) diff --git a/bin/cdist b/bin/cdist index 5c1239fb..5a6ce92f 100755 --- a/bin/cdist +++ b/bin/cdist @@ -22,5 +22,8 @@ # Wrapper for real script to allow execution from checkout 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/../cdist.py" "$@" +PYTHONPATH="${dir}/../" "$dir/../scripts/cdist" "$@" diff --git a/cdist.py b/scripts/cdist similarity index 100% rename from cdist.py rename to scripts/cdist