uskudnik / amazon-glacier-cmd-interface

Command line interface for Amazon Glacier
MIT License
374 stars 100 forks source link

--stdin is broken #85

Closed lschweiss closed 11 years ago

lschweiss commented 11 years ago

Seem it is breaking the command line parser.

With the command:

cat testfile | glacier-cmd upload testvault --description test --stdin --name test

This is the result:

Traceback (most recent call last):
  File "/usr/bin/glacier-cmd", line 8, in <module>
    load_entry_point('glacier==0.2dev', 'console_scripts', 'glacier-cmd')()
  File "/usr/lib/python2.6/site-packages/glacier-0.2dev-py2.6.egg/glacier/glacier.py", line 751, in main
    args.func(args)
  File "/usr/lib/python2.6/site-packages/glacier-0.2dev-py2.6.egg/glacier/glacier.py", line 147, in wrapper
    return fn(*args, **kwargs)
  File "/usr/lib/python2.6/site-packages/glacier-0.2dev-py2.6.egg/glacier/glacier.py", line 312, in upload
    response = glacier.upload(args.vault, f, args.description, args.region, args.stdin,
UnboundLocalError: local variable 'f' referenced before assignment
wvmarle commented 11 years ago

Fixed. See pull request #86. Simple typo.

I'm sure I've been testing this - probably on another branch or so. Sorry for the inconvenience!

uskudnik commented 11 years ago

Merged into master, closing.

DaveQB commented 11 years ago

I have this same issue now (a regression?)

I did a clone 2 nights ago I think. Latest commit in the clone I built from...

commit 7f9227ad2af1f417c1d11640f8582ceb464153c0
Merge: 9760df5 b209185
Author: Urban Škudnik <urban.skudnik@gmail.com>
Date:   Fri Nov 9 18:09:21 2012 -0800

    Merge pull request #101 from stigger/upload_part_fix

    We have to call .read() on layer1.upload_part's response,…

It looks like I have pull request #86 in my copy, so maybe a new bug?

Traceback (most recent call last):                                                                                                                                                                                                        
  File "/usr/local/bin/glacier-cmd", line 9, in <module>
    load_entry_point('glacier==0.2dev', 'console_scripts', 'glacier-cmd')()
  File "/usr/local/lib/python2.7/dist-packages/glacier-0.2dev-py2.7.egg/glacier/glacier.py", line 751, in main
    args.func(args)
  File "/usr/local/lib/python2.7/dist-packages/glacier-0.2dev-py2.7.egg/glacier/glacier.py", line 147, in wrapper
    return fn(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/glacier-0.2dev-py2.7.egg/glacier/glacier.py", line 313, in upload
    args.name, args.partsize, args.uploadid, args.resume)
  File "/usr/local/lib/python2.7/dist-packages/glacier-0.2dev-py2.7.egg/glacier/GlacierWrapper.py", line 62, in wrapper
    ret = fn(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/glacier-0.2dev-py2.7.egg/glacier/GlacierWrapper.py", line 221, in glacier_connect_wrap
    return func(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/glacier-0.2dev-py2.7.egg/glacier/GlacierWrapper.py", line 62, in wrapper
    ret = fn(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/glacier-0.2dev-py2.7.egg/glacier/GlacierWrapper.py", line 242, in sdb_connect_wrap
    return func(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/glacier-0.2dev-py2.7.egg/glacier/GlacierWrapper.py", line 62, in wrapper
    ret = fn(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/glacier-0.2dev-py2.7.egg/glacier/GlacierWrapper.py", line 1142, in upload
    f.close()
UnboundLocalError: local variable 'f' referenced before assignment
DaveQB commented 11 years ago

In file glacier/GlacierWrapper.py (where the error seems to be) f is only assigned on line 946 inside an if..then statement. The if condition is if not stdin, but in my situation it was, so therefore f is never assigned.

Perhaps like 1142 just needs to be removed?

offlinehacker commented 11 years ago

Perhaps my rewrite of code for upload needs to be finished, but i am pretty busy lately ;)

On Wed, Nov 21, 2012 at 10:57 AM, DaveQB notifications@github.com wrote:

In file glacier/GlacierWrapper.py (where the error seems to be) f is only assigned on line 946 inside an if..then statement. The if condition is if not stdin, but in my situation it was, so therefore f is never assigned.

Perhaps like 1142 just needs to be removed?

— Reply to this email directly or view it on GitHubhttps://github.com/uskudnik/amazon-glacier-cmd-interface/issues/85#issuecomment-10591164.

uskudnik commented 11 years ago

How far are you, any large chunks missing that I can help with or just minor thingies?

On Nov 21, 2012, at 11:10 , Jaka Hudoklin notifications@github.com wrote:

Perhaps my rewrite of code for upload needs to be finished, but i am pretty busy lately ;)

On Wed, Nov 21, 2012 at 10:57 AM, DaveQB notifications@github.com wrote:

In file glacier/GlacierWrapper.py (where the error seems to be) f is only assigned on line 946 inside an if..then statement. The if condition is if not stdin, but in my situation it was, so therefore f is never assigned.

Perhaps like 1142 just needs to be removed?

— Reply to this email directly or view it on GitHubhttps://github.com/uskudnik/amazon-glacier-cmd-interface/issues/85#issuecomment-10591164.

— Reply to this email directly or view it on GitHub.

offlinehacker commented 11 years ago

A small part and a lot of testing. What about another sprint where we finish it? On Nov 21, 2012 6:09 PM, "Urban Škudnik" notifications@github.com wrote:

How far are you, any large chunks missing that I can help with or just minor thingies?

On Nov 21, 2012, at 11:10 , Jaka Hudoklin notifications@github.com wrote:

Perhaps my rewrite of code for upload needs to be finished, but i am pretty busy lately ;)

On Wed, Nov 21, 2012 at 10:57 AM, DaveQB notifications@github.com wrote:

In file glacier/GlacierWrapper.py (where the error seems to be) f is only assigned on line 946 inside an if..then statement. The if condition is if not stdin, but in my situation it was, so therefore f is never assigned.

Perhaps like 1142 just needs to be removed?

— Reply to this email directly or view it on GitHub< https://github.com/uskudnik/amazon-glacier-cmd-interface/issues/85#issuecomment-10591164>.

— Reply to this email directly or view it on GitHub.

— Reply to this email directly or view it on GitHubhttps://github.com/uskudnik/amazon-glacier-cmd-interface/issues/85#issuecomment-10605662.

uskudnik commented 11 years ago

Hmmm… Maybe I stay for another weekend… how does that suite you?

On Nov 21, 2012, at 22:37 , Jaka Hudoklin notifications@github.com wrote:

A small part and a lot of testing. What about another sprint where we finish it? On Nov 21, 2012 6:09 PM, "Urban Škudnik" notifications@github.com wrote:

How far are you, any large chunks missing that I can help with or just minor thingies?

On Nov 21, 2012, at 11:10 , Jaka Hudoklin notifications@github.com wrote:

Perhaps my rewrite of code for upload needs to be finished, but i am pretty busy lately ;)

On Wed, Nov 21, 2012 at 10:57 AM, DaveQB notifications@github.com wrote:

In file glacier/GlacierWrapper.py (where the error seems to be) f is only assigned on line 946 inside an if..then statement. The if condition is if not stdin, but in my situation it was, so therefore f is never assigned.

Perhaps like 1142 just needs to be removed?

— Reply to this email directly or view it on GitHub< https://github.com/uskudnik/amazon-glacier-cmd-interface/issues/85#issuecomment-10591164>.

— Reply to this email directly or view it on GitHub.

— Reply to this email directly or view it on GitHubhttps://github.com/uskudnik/amazon-glacier-cmd-interface/issues/85#issuecomment-10605662.

— Reply to this email directly or view it on GitHub.