Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config.get_config_filename tries to return unset property #5

Open
jackric opened this issue Apr 29, 2010 · 0 comments
Open

config.get_config_filename tries to return unset property #5

jackric opened this issue Apr 29, 2010 · 0 comments

Comments

@jackric
Copy link

jackric commented Apr 29, 2010

Running under cygwin,

Traceback (most recent call last):
File "./loxodo.py", line 13, in
from src.config import config
File "/cygdrive/C/loxodo/sommer-loxodo-afb514c/src/config.py", line 149, in
config = Config()
File "/cygdrive/C/loxodo/sommer-loxodo-afb514c/src/config.py", line 45, in init
self._fname = self.get_config_filename()
File "/cygdrive/C/loxodo/sommer-loxodo-afb514c/src/config.py", line 142, in get_config_filename
base_path = os.path.dirname(config.get_basescript())
NameError: global name 'config' is not defined

get_config_filename is supposed to be a static method and it's calling on the instance 'config' which is not defined yet since we're still in the flow of init()

Can fix by changing line 140 from:
base_path = os.path.dirname(config.get_basescript())
to
base_path = os.path.dirname(unicode(file, sys.getfilesystemencoding()))

Needs an import sys at the top of config.py though.

Is there a cleaner way of doing this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant