How do I pass a string into subprocess.Popen (using the stdin argument)?

Popen.communicate() documentation: Note that if you want to send data to the process’s stdin, you need to create the Popen object with stdin=PIPE. Similarly, to get anything other than None in the result tuple, you need to give stdout=PIPE and/or stderr=PIPE too. Replacing os.popen* pipe = os.popen(cmd, ‘w’, bufsize) # ==> pipe = Popen(cmd, shell=True, … Read more

How do I read from stdin?

Use the fileinput module: import fileinput for line in fileinput.input(): pass fileinput will loop through all the lines in the input specified as file names given in command-line arguments, or the standard input if no arguments are provided. Note: line will contain a trailing newline; to remove it use line.rstrip().

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)