ternjs / tern_for_sublime

Sublime Text package adding Tern support
MIT License
801 stars 52 forks source link

TypeError: coercing to Unicode: need string or buffer, list found #45

Open soundasleep opened 10 years ago

soundasleep commented 10 years ago

I can't get tern_for_sublime working on Sublime Text 2 (which I think is running Python 2.6?), Windows 7 x64 SP1. I've installed tern through npm install -g tern, and set the paths as necessary in my user settings:

  "tern_command": "c:\\users\\jevon\\appdata\\roaming\\npm\\tern",
  "auto_complete_triggers": [ {"selector": "text.html", "characters": "<"}, {"selector": "source.js", "characters": "."} ]

When I try to edit a Javascript file or get an autocomplete dialog, the console shows errors:

Traceback (most recent call last):
  File ".\sublime_plugin.py", line 236, in on_query_completions
  File ".\tern.py", line 54, in on_query_completions
  File ".\tern.py", line 356, in ensure_completions_cached
  File ".\tern.py", line 277, in run_command
  File ".\tern.py", line 151, in server_port
  File ".\tern.py", line 163, in start_server
TypeError: coercing to Unicode: need string or buffer, list found
Traceback (most recent call last):
  File ".\sublime_plugin.py", line 210, in on_deactivated
  File ".\sublime_plugin.py", line 154, in run_timed_function
  File ".\sublime_plugin.py", line 209, in <lambda>
  File ".\tern.py", line 33, in on_deactivated
  File ".\tern.py", line 21, in on_deactivated
  File ".\tern.py", line 322, in send_buffer
  File ".\tern.py", line 151, in server_port
  File ".\tern.py", line 163, in start_server
TypeError: coercing to Unicode: need string or buffer, list found

From what I can tell it's trying to convert tern_arguments, which is an empty list (defined on line 16 of tern.py), into a string and failing. Removing the tern_arguments solves the error and Tern works.

marijnh commented 10 years ago

tern_command should be an array, not a string.