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 dvarrazzo added a commit that referenced this pull request Nov 10, 2012
@dvarrazzo Fixed traceback on error when a dir doesn't contain META.json
Closes issue #19.
4e53463
@dvarrazzo dvarrazzo added a commit that referenced this pull request Nov 10, 2012
@dvarrazzo Fixed traceback on error when a dir doesn't contain META.json
Closes issue #19.
76426ac
@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 Nov 10, 2012
@dvarrazzo dvarrazzo added a commit that referenced this pull request Nov 10, 2012
@dvarrazzo Fixed traceback on error when a dir doesn't contain META.json
Closes issue #19.
7441601
@dvarrazzo dvarrazzo added a commit that referenced this pull request Nov 10, 2012
@dvarrazzo Fixed traceback on error when a dir doesn't contain META.json
Closes issue #19.
af6597d
@dvarrazzo dvarrazzo added a commit that referenced this pull request May 12, 2013
@dvarrazzo Report closure of issue #19 in changelog 299bf48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment