Skip to content Skip to sidebar Skip to footer

Typeerror: Coercing To Unicode, Need String Or Buffer, Nonetype Found

Currently writing a function for a program and one component is to search whether a single variables are being used within a python file. FUNCTION: def SINGLE_CHAR_VAR(python_file

Solution 1:

python_filename is set to None, which is not a valid argument for the open() function:

>>> open(None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: coercing toUnicode: need stringor buffer, NoneType found

Whypython_filename is None cannot be determined from the code you posted. The traceback you supplied suggests the value originates in the sorted_list() function, I suggest you start looking there for clues:

  File "lint_2.py", line 84, in sorted_listerror_list= total_error_list(python_filename)

However, that is just a guess; you'll have to trace through all the code in that traceback to see where exactly the None is first set.

Solution 2:

Try writing this way:

ssh.exec_command()
stdin.flush()
stdin.channel.shutdown_write()

It should work

Post a Comment for "Typeerror: Coercing To Unicode, Need String Or Buffer, Nonetype Found"