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

2018-11-12 Thread Chris Angelico
On Mon, Nov 12, 2018 at 11:20 PM Anssi Saari wrote: > > Chris Angelico writes: > > > On Fri, Nov 9, 2018 at 11:11 PM Anssi Saari wrote: > >> > >> Chris Angelico writes: > >> > >> > No helper needed. Safe against command injection. Uses the known > >> > format of the command's output; if you

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

2018-11-12 Thread Anssi Saari
Chris Angelico writes: > On Fri, Nov 9, 2018 at 11:11 PM Anssi Saari wrote: >> >> Chris Angelico writes: >> >> > No helper needed. Safe against command injection. Uses the known >> > format of the command's output; if you want other information as well >> > as the type, you could get that too.

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

2018-11-09 Thread Cousin Stanley
srinivasan wrote: > Even after changing as per the below > "blkid -o export %s | grep 'TYPE' | cut -d'=' -f3" > or: > 'blkid -o export %s | grep "TYPE" | cut -d"=" -f3' > or: > "blkid -o export %s | grep \"TYPE\" | cut -d\"=\" -f3" > > Still my output is: > */dev/mmcblk1p1: LABEL="efi"

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

2018-11-09 Thread Chris Angelico
On Fri, Nov 9, 2018 at 11:11 PM Anssi Saari wrote: > > Chris Angelico writes: > > > No helper needed. Safe against command injection. Uses the known > > format of the command's output; if you want other information as well > > as the type, you could get that too. > > Can someone let me in on

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

2018-11-09 Thread Anssi Saari
Chris Angelico writes: > No helper needed. Safe against command injection. Uses the known > format of the command's output; if you want other information as well > as the type, you could get that too. Can someone let me in on this secret helper module? Doesn't seem to match the helper module in

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

2018-11-07 Thread srinivasan
Many Thanks a lot , I can use for reliably "lsblk %s -n -o FSTYPE" in the reused code of mine as below cmd = "lsblk %s -n -o FSTYPE" % partition_path return self._helper.execute_cmd_output_string(cmd) I really appreciate for all your support w.r.t this.. I feel I have kick

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

2018-11-07 Thread Ben Bacarisse
srinivasan writes: > Even after changing as per the below > "blkid -o export %s | grep 'TYPE' | cut -d'=' -f3" > or: > 'blkid -o export %s | grep "TYPE" | cut -d"=" -f3' > or: > "blkid -o export %s | grep \"TYPE\" | cut -d\"=\" -f3" > > Still my output is: > */dev/mmcblk1p1: LABEL="efi"

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

2018-11-07 Thread Chris Angelico
On Wed, Nov 7, 2018 at 11:42 PM srinivasan wrote: > > Some I managed to fix temporarily as below, might be useful for others. Also > please correct me if anything wrong or for any improvements in the below > > cmd = "blkid -o export %s" % partition_path > out =

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

2018-11-07 Thread srinivasan
Some I managed to fix temporarily as below, might be useful for others. Also please correct me if anything wrong or for any improvements in the below cmd = "blkid -o export %s" % partition_path out = self._helper.execute_cmd_output_string(cmd) var = out.split("TYPE=",

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

2018-11-07 Thread Chris Angelico
On Wed, Nov 7, 2018 at 11:36 PM Qian Cai wrote: > > srinivasan wrote: > > Even after changing as per the below > > "blkid -o export %s | grep 'TYPE' | cut -d'=' -f3" > > or: > > 'blkid -o export %s | grep "TYPE" | cut -d"=" -f3' > > or: > > "blkid -o export %s | grep \"TYPE\" | cut -d\"=\" -f3"

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

2018-11-07 Thread Qian Cai
srinivasan wrote: > Even after changing as per the below > "blkid -o export %s | grep 'TYPE' | cut -d'=' -f3" > or: > 'blkid -o export %s | grep "TYPE" | cut -d"=" -f3' > or: > "blkid -o export %s | grep \"TYPE\" | cut -d\"=\" -f3" > > Still my output is: > */dev/mmcblk1p1: LABEL="efi"

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

2018-11-07 Thread srinivasan
Even after changing as per the below "blkid -o export %s | grep 'TYPE' | cut -d'=' -f3" or: 'blkid -o export %s | grep "TYPE" | cut -d"=" -f3' or: "blkid -o export %s | grep \"TYPE\" | cut -d\"=\" -f3" Still my output is: */dev/mmcblk1p1: LABEL="efi" UUID="1084-AA42" TYPE="vfat"* My expected

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

2018-11-07 Thread Brian J. Oney via Python-list
On Wed, 2018-11-07 at 10:22 +0100, srinivasan wrote: > blkid -o export %s | grep \'TYPE\' | cut -d\"=\" -f3 You don't need to escape the single quotes. Try either: "blkid -o export %s | grep 'TYPE' | cut -d'=' -f3" or: 'blkid -o export %s | grep "TYPE" | cut -d"=" -f3' or: "blkid -o export %s |

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

2018-11-07 Thread srinivasan
After changing the line to *"cmd = "blkid -o export %s | grep \'TYPE\' | cut -d\"=\" -f3" % fs"*, Now I dont see the error "SyntaxError: can't assign to literal" This is not returning exactly "*vfat*" instead of this, it is returning as "*

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

2018-11-06 Thread Rhodri James
On 06/11/2018 18:10, srinivasan wrote: root:~/qa/test_library# python3 sd.py File "sd.py", line 99 *cmd = "blkid -o export %s | grep 'TYPE' | cut -d"=" -f3" % (fs)* * ^* *SyntaxError: can't assign to literal* Look at the 'cut' element of the p

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

2018-11-06 Thread srinivasan
Dear Python Experts Team, As am newbie to python development, I am trying to use the below function to get verify the filesystem type of the SD card parition using bash command in python using subprocess module, I ma seeing the below Error "SyntaxError: can't assign to literal&qu

Re: can't assign to literal

2008-06-14 Thread TheSaint
On 17:06, venerdì 13 giugno 2008 Dennis Lee Bieber wrote: -=-=-=-=-=-=- (make sure you have a fixed width client) Very good indeed :) Specially to do with block reformatting. I just post my script to demonstrate my thoughts in what I meant as justifying. Specially considering that I meant

Re: can't assign to literal

2008-06-13 Thread TheSaint
On 15:11, giovedì 12 giugno 2008 Dennis Lee Bieber wrote: Word spaced line justification is only feasible if one is using a fixed width font and have a line length defined in characters/line. ===8==8==8==8==8==8==8==8==8==8 line= 'fixed width font and have

My editing style (was: can't assign to literal)

2008-06-13 Thread TheSaint
On 14:49, giovedì 12 giugno 2008 Chris wrote: You should strip all extraneous white space from code though. For my taste, trailing spaces will be removed by my editor (Kate :) ) Other space tabulators are an issue which won't suite my needs. -- Mailsweeper Home :

Re: can't assign to literal

2008-06-12 Thread TheSaint
On 01:37, giovedì 12 giugno 2008 Ethan Furman wrote: Do you mean indenting, or wrapping? I mean fill the line by increasing spaces between words in order to get a paragraph aligned both side, left and right on the page. So if the width is 78 chars it wouldn't have jig saw end to the right side,

Re: can't assign to literal

2008-06-12 Thread Chris
On Jun 12, 8:03 am, TheSaint [EMAIL PROTECTED] wrote: On 01:37, giovedì 12 giugno 2008 Ethan Furman wrote: Do you mean indenting, or wrapping? I mean fill the line by increasing spaces between words in order to get a paragraph aligned both side, left and right on the page. So if the width

Re: can't assign to literal

2008-06-12 Thread Ethan Furman
TheSaint wrote: On 01:37, giovedì 12 giugno 2008 Ethan Furman wrote: Do you mean indenting, or wrapping? I mean fill the line by increasing spaces between words in order to get a paragraph aligned both side, left and right on the page. So if the width is 78 chars it wouldn't have jig saw

Re: can't assign to literal

2008-06-11 Thread Chris
On Jun 11, 10:32 am, MRAB [EMAIL PROTECTED] wrote: On Jun 10, 10:57 pm, Steven Clark [EMAIL PROTECTED] wrote: for 1 in oids, vals head_oids: SyntaxError: can't assign to literal -- 1 is a literal, you can't assign it to something. Are you trying to use it as a variable name

Re: can't assign to literal

2008-06-11 Thread MRAB
On Jun 10, 10:57 pm, Steven Clark [EMAIL PROTECTED] wrote: for 1 in oids, vals head_oids: SyntaxError: can't assign to literal -- 1 is a literal, you can't assign it to something. Are you trying to use it as a variable name? Slightly OT, but is there an editor that can display digits

Re: can't assign to literal

2008-06-11 Thread Lie
On Jun 11, 3:32 pm, MRAB [EMAIL PROTECTED] wrote: On Jun 10, 10:57 pm, Steven Clark [EMAIL PROTECTED] wrote: for 1 in oids, vals head_oids: SyntaxError: can't assign to literal -- 1 is a literal, you can't assign it to something. Are you trying to use it as a variable name

Re: can't assign to literal

2008-06-11 Thread Lie
On Jun 11, 2:53 am, maehhheeyy [EMAIL PROTECTED] wrote: this is stopping my program from running properly. is there something wrong in my code when that happens? That simply means you did something like this: 'hello' = 'another' 123 = 'kilo' [12, 'asd] = 123 Sometimes it's not that obvious

Re: can't assign to literal

2008-06-11 Thread TheSaint
On 16:47, mercoledì 11 giugno 2008 Chris wrote: SciTE and Notepad++ Pype, spe, just to point it out. Jedit, but rather a bloatware. I'd like to know which is the litest multi platform and indipendent. Pype is very good when compiled in exe, but not doing in Linux in that way. -- Mailsweeper

Re: can't assign to literal

2008-06-11 Thread Ethan Furman
MRAB wrote: On Jun 10, 10:57 pm, Steven Clark [EMAIL PROTECTED] wrote: for 1 in oids, vals head_oids: SyntaxError: can't assign to literal -- 1 is a literal, you can't assign it to something. Are you trying to use it as a variable name? Slightly OT, but is there an editor that can display

Re: can't assign to literal

2008-06-11 Thread TheSaint
On 00:15, giovedì 12 giugno 2008 Ethan Furman wrote: I like Vim (Vi Improved) What about justifying text ? -- Mailsweeper Home : http://it.geocities.com/call_me_not_now/index.html -- http://mail.python.org/mailman/listinfo/python-list

Re: can't assign to literal

2008-06-11 Thread Ethan Furman
TheSaint wrote: On 00:15, giovedì 12 giugno 2008 Ethan Furman wrote: I like Vim (Vi Improved) What about justifying text ? Do you mean indenting, or wrapping? Vim has excellent indenting support, and Python files already included that support proper indenting, syntax coloring, etc. I

can't assign to literal

2008-06-10 Thread maehhheeyy
this is stopping my program from running properly. is there something wrong in my code when that happens? -- http://mail.python.org/mailman/listinfo/python-list

Re: can't assign to literal

2008-06-10 Thread Matimus
On Jun 10, 12:53 pm, maehhheeyy [EMAIL PROTECTED] wrote: this is stopping my program from running properly. is there something wrong in my code when that happens? yes Post your code, or at least the full error message if you want more details. Matt --

Re: can't assign to literal

2008-06-10 Thread maehhheeyy
details. Matt for 1 in oids, vals head_oids: SyntaxError: can't assign to literal -- http://mail.python.org/mailman/listinfo/python-list

Re: can't assign to literal

2008-06-10 Thread Steven Clark
Post your code, or at least the full error message if you want more details. Matt for 1 in oids, vals head_oids: SyntaxError: can't assign to literal -- http://mail.python.org/mailman/listinfo/python-list Wow. http://catb.org/~esr/faqs/smart-questions.html -- http://mail.python.org

Re: can't assign to literal

2008-06-10 Thread Steven Clark
for 1 in oids, vals head_oids: SyntaxError: can't assign to literal -- 1 is a literal, you can't assign it to something. Are you trying to use it as a variable name? -- http://mail.python.org/mailman/listinfo/python-list

Re: can't assign to literal

2008-06-10 Thread Larry Bates
if you want more details. Matt for 1 in oids, vals head_oids: SyntaxError: can't assign to literal That statement makes no sense (thus SyntaxError). for 1 (one) in oids, vals head_oids: has several problems: 1 - for source variable can't be a number it has to be a name in oids, vals