subprocess.CalledProcessError:命令“curl…”返回非零退出状态1

2024-06-16 13:27:04 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个很奇怪的案子。我正在桌面上使用win10pro(64位)和Python3.4.3,其中脚本可以正常工作。当我在笔记本上启动相同的脚本(win10home64bit,python3.4.3)时,它就不起作用了。在

代码是:

import json
from pprint import pprint
import os, sys
from subprocess import check_output
username = "ka...s"
playlist_tracks_file_path = 'F:\\EDU\\PYTHON\\njtest\\PLLs\\'
playlist_id = "7oCx..4d"
bearer = "BQDy...WVv3A"
`# ----------------------------------------------`
`# Get spotify playlist name from its playlist ID`
`# ----------------------------------------------`
PLL_URL = '\"https://api.spotify.com/v1/users/'+username+'/playlists/'+playlist_id+'\"'
PLL_curl_cmd = "curl -X GET "+PLL_URL+ " -H \"Accept: application/json\" -H \"Authorization: Bearer " +bearer+'\"'

dirc = check_output(PLL_curl_cmd, shell=True).decode('utf-8')
data =  json.loads(dirc)

以及输出:

^{pr2}$

你知道是什么原因吗?在

希望,我没有忘记一些重要的信息。在


Tags: fromimport脚本idjsonurloutputcheck