gpt4 book ai didi

python - 类型错误 : cannot concatenate 'str' and 'function' objects python files

转载 作者:太空宇宙 更新时间:2023-11-04 05:55:23 24 4
gpt4 key购买 nike

我的 python 代码应该下载 rmtp 视频,但我收到此错误:

Error: cannot concatenate 'str' and 'function' objects

我以前从未见过这个错误,请帮忙!

cmd = 'rtmpdump -r -T "sdjsds8" -r "'+player+'" -a "vod" -f "WIN 13,0,0,182" -W "http://website.fr/components/com_vodvideo/mediaplayer/player-licensed.swf" -p "http://website.fr" -y "mp4:'+code+'" -o "MaVideo.flv'

这是我的代码:

import ConfigParser
import requests,re,os,sys
from xrez import quality_FHD
from xrez import quality_HD
from xrez import quality_SD

def Fonction_smil():
global Resolution
config = ConfigParser.ConfigParser()
config.read('config.ini')
quality = config.get('SETTINGS', 'video_quality')
if quality == '1080p':
Resolution = (quality_FHD('qualityFHD'))
elif quality == '720p':
Resolution = (quality_HD('qualityHD'))
elif quality == '480p':
Resolution = (quality_SD('qualitySD'))

url = Resolution

print "downloading with requests"
r = requests.get(url)
with open("video.smil", "wb") as code:
code.write(r.content)


mykey = open("/home/gaaara/adn/video.smil", "r")
for text in mykey:
match = re.search('base="(.*?)"', text)
if match:
vod_links = str(match.group(1))

print vod_links


print 'telechargement de la video...'
cmd = 'rtmpdump -v -T "fbfhfhfh" -r "'+ url +'" -a "vod" -f "WIN 13,0,0,182" -W "http://website.com/components/com_vodvideo/mediaplayer/player-licensed.swf" -p "http://website.com" -y "mp4:'+code+'" -o "mavideo.mp4"'
os.system(cmd)

编辑:我在主脚本上有这个错误,但在 smil.py 上没有。

当我导入函数时

from smil import Fonction_smil

我收到这个错误

Traceback (most recent call last): File "start.py", line 35, in from smil import Fonction_smil File "files/smil.py", line 30, in if match: NameError: name 'match' is not defined

最佳答案

您的url 变量不包含字符串,而是一个函数。您可能需要执行类似 "..."+ url() + "..." 的操作。

您的code 变量包含一个文件,而不是一个字符串。因此,您不能使用字符串 + 它。这将是下一个问题:)

关于python - 类型错误 : cannot concatenate 'str' and 'function' objects python files,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28096857/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com