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

SyntaxError: can use starred expression only as assignment target #7

Closed
AdrianKoshka opened this issue Jan 24, 2016 · 13 comments
Closed

Comments

@AdrianKoshka
Copy link

I recently recloned the vimiv repo, and did sudo make to install.
Although when I try to use vimiv at all, I get this:

$vimiv
  File "/usr/bin/vimiv", line 2466

            ^
SyntaxError: can use starred expression only as assignment target

From the error I'm guessing you have a syntax mistake in the code, I don't know enough about python to fix it myself.

@professorjamesmoriarty
Copy link

@karlch This appears to be a issue on python 3.4 and such. Not an issue on python 3.5. Guessing it is related to https://www.python.org/dev/peps/pep-0448/ . Are you targeting 3.5 entirely, or python3 in general?

@karlch
Copy link
Owner

karlch commented Jan 24, 2016

@shaggytwodope Your conclusion seems correct.

I am currently the only developer and tester of vimiv using up-to-date arch linux systems. For simplicity I will target python3.5 for the moment and make it a dependency. The chances are that the libraries like PIL also through errors with older versions.

If I find some more time, I might install a stable debian (-based) system to check backwards compatibility. But no promises on that one. Of course if anyone feels like taking care of this I would happily pull.

@AdrianKoshka Out of interest, which distro with which python version are you running?
For a quick and dirty fix, you can replace lines 2466 with a for loop:

args = []
for arg in bind[2:]:
    args.append(arg)
binding = [key, bind[1], args]

@AdrianKoshka
Copy link
Author

@karlch, @shaggytwodope suggested to me just removing the offending * as a hacky fix, it worked, what would be the different between your for loop and the hacky fix I've implemented?

I use lubuntu 15.10 and run Python 3.4.3+

@AdrianKoshka
Copy link
Author

I've implemented @karlch's fixed and things seem to be working as well.

@karlch
Copy link
Owner

karlch commented Jan 24, 2016

There is none and the for loop was completely unneccessary. Shame on me for trying to fix this on the fly. I actually wanted to do the following:

binding = [key, bind[1]]
for arg in bind[2:]:
    binding.append(arg)

which cleanly adds all the elements of the bind[2:] list to the end of the binding list just as the * operator does.

None of the two previous solutions (my stupid one and @shaggytwodope's hacky version) work for me using python3.5 and I am not sure why they work in earlier versions. Removing the * operator means that the bind[2:] list remains a list and this leads to missing arguments for the function call funk(*args) a few lines later.

@shaggytwodope could you explain this? :)

@AdrianKoshka
Copy link
Author

@karlch Implementing your latest fix seems to work also, though is q supposed to exit vimiv, because now when I press q nothing happens and if memory serves me q was the quit button.

@AdrianKoshka
Copy link
Author

Going back into the config file and looking, yes q _SHOULD_ quit but with @karlch's latest "patch" it no longer functions.

@karlch
Copy link
Owner

karlch commented Jan 24, 2016

I took some time to take a look at this properly and to test it under python 3.4.3 booting from a live environment. For me the latest patch works there as well, whereas the hacky version breaks commands with arguments, e.g. scrolling with h, j, k, l.

To make sure we are talking about the same patches I have appended two files: vimiv_hacky.txt and vimiv_patch2.txt with the patches the way I understand them. The ending .txt because Github complained without an ending...
vimiv_hacky.txt
vimiv_patch2.txt

@AdrianKoshka
Copy link
Author

Yes we are talking about the same patches. q (haven't tested other keys) as I've said isn't working for ME, perhaps if you make a branch for testing this issue with the second patch included, I could clone this "clean" repo and test it again.

@karlch
Copy link
Owner

karlch commented Jan 25, 2016

I will not create this "clean" repo because key_handling and configuration files will change completely in version 0.5 anyway. For the moment you can just use whatever workaround works for you.

The branch version0.5 was created though, feel free to try it. It is still not considered stable though and the documentation is a complete chaos at the moment.

As soon as version 0.5 is merged into master I will close this issue and create a new one with a more general title concerning backwords compatibility.

@AdrianKoshka
Copy link
Author

Okay, I'll just wait until version 0.5

@karlch
Copy link
Owner

karlch commented Jan 30, 2016

Just to inform you, I pushed version 0.5 to master. Should be solved.

@AdrianKoshka
Copy link
Author

Thank you! keybinds seem to be working now!

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

3 participants