[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Python-Dev] SyntaxError: can't assign to literal while using ""blkid -o export %s | grep 'TYPE' | cut -d"=" -f3" % (fs)" using subprocess module in Python

This list is for the development *of* the Python interpreter, not 
support for *using* Python. If you signed up to this mailing list via 
the web, it clearly says:

    Do not post general Python questions to this list.

highlighted in a great big box in red. Was that not clear enough? What 
can we do to make that more clear?

You can try many other places for support, such as Stackoverflow, 
Reddit's /r/LearnPython, or the Python tutor mailing list:


but I expect most of them will tell you the same thing. You should try 
to give a *minimum* example of your problem, not your entire script. 
Start by reading here:


As for your SyntaxError, the problem is line 99:

>   File "sd.py", line 99
> *    cmd = "blkid -o export %s | grep 'TYPE' | cut -d"=" -f3" % (fs)*
> *         ^*
> *SyntaxError: can't assign to literal*

The arrow ^ is pointing to the wrong equals sign, but simplifying the 
code and adding spaces makes it clear:

cmd = "spam" = "eggs"

gives the same error. Perhaps you mean == (equals) or perhaps the second 
assignment shouldn't be there at all?