diff --git a/runtime/lua/provider/python/health.lua b/runtime/lua/provider/python/health.lua index d72b897779..058a15ca66 100644 --- a/runtime/lua/provider/python/health.lua +++ b/runtime/lua/provider/python/health.lua @@ -77,12 +77,14 @@ local function download(url) return out end elseif vim.fn.executable('python') == 1 then - local script = "try:\n\ - from urllib.request import urlopen\n\ - except ImportError:\n\ - from urllib2 import urlopen\n\ - response = urlopen('" .. url .. "')\n\ - print(response.read().decode('utf8'))\n" + local script = ([[ +try: + from urllib.request import urlopen +except ImportError: + from urllib2 import urlopen +response = urlopen('%s') +print(response.read().decode('utf8')) +]]):format(url) local out, rc = health.system({ 'python', '-c', script }) if out == '' and rc ~= 0 then return 'python urllib.request error: ' .. rc