Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix misspelling of spec variable name in missing META.json exception mes... #19

Closed
wants to merge 1 commit into from

2 participants

@grzm

When using pgxnclient to load a directory spec without a META.json file, I got the following error:

File "/usr/lib/python2.6/site-packages/pgxnclient/commands/init.py", line 387, in get_meta
_("file 'META.json' not found in '%s'") % dir)
UnboundLocalError: local variable 'dir' referenced before assignment

Replacing "dir" with "spec" fixes the issue: the directory is properly reported in the (expected) exception message.

Full stack trace below.

I briefly explored writing a test to cover this case, but I'm afraid my python is not up to snuff :/

Thanks for your work on this useful tool!

[vagrant@vagrant-centos-56-64 ~]$ sudo pgxn load -p 5432 -U postgres -d postgres --pg_config /some/path/to/pgsql/bin/pg_config /some/path/to/pgvihash/
ERROR: unexpected error: UnboundLocalError - local variable 'dir' referenced before assignment
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/pgxnclient/cli.py", line 59, in script
main(args)
File "/usr/lib/python2.6/site-packages/pgxnclient/cli.py", line 31, in main
run_command(opt, parser)
File "/usr/lib/python2.6/site-packages/pgxnclient/commands/init.py", line 96, in run_command
return opts.cmd(opts, parser=parser).run()
File "/usr/lib/python2.6/site-packages/pgxnclient/commands/install.py", line 446, in run
items = self.get_extensions()
File "/usr/lib/python2.6/site-packages/pgxnclient/commands/install.py", line 404, in get_extensions
dist = self.get_meta(spec)
File "/usr/lib/python2.6/site-packages/pgxnclient/commands/__init
.py", line 387, in get_meta
_("file 'META.json' not found in '%s'") % dir)
UnboundLocalError: local variable 'dir' referenced before assignment

@grzm grzm Fix misspelling of spec variable name in missing META.json exception …
…message.

Change-Id: I650194e211fe5af7a9d026b320a944e152b7ea9b
83b2f33
@dvarrazzo
Owner

Thank you very much for the report. I've fixed it in a slightly different way and added a test.

@dvarrazzo dvarrazzo closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 9, 2012
  1. @grzm

    Fix misspelling of spec variable name in missing META.json exception …

    grzm authored
    …message.
    
    Change-Id: I650194e211fe5af7a9d026b320a944e152b7ea9b
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  pgxnclient/commands/__init__.py
View
2  pgxnclient/commands/__init__.py
@@ -384,7 +384,7 @@ def get_meta(self, spec):
logger.debug("reading %s", fn)
if not os.path.exists(fn):
raise PgxnClientException(
- _("file 'META.json' not found in '%s'") % dir)
+ _("file 'META.json' not found in '%s'") % spec)
with open(fn) as f:
return load_json(f)
Something went wrong with that request. Please try again.