这是我的自动广播录音' python脚本。
要运行此脚本, python /path/path/ebs.py名称1190(长度)
当我在终端上键入它时,它完美无缺。 但是当我在Crontab上这样做时。
40 6 * * 1-6 python /Users/myname/Dropbox/ebs/ebs.py耳朵10
我有这样的错误报告。
Traceback (most recent call last):
File "ebs.py", line 31, in <module>
recording()
File "ebs.py", line 23, in recording
p = subprocess.Popen(rtmpdump)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 710, in __init__
errread, errwrite)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1335, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
这是我的原始剧本
# coding: utf8
'''
Created on 2015. 9. 5.
'''
import subprocess
import datetime
import sys
import os
def recording() :
radio_addr = "rtmp://ebsandroid.ebs.co.kr/fmradiofamilypc/familypc1m"
program_name = sys.argv[1]
record_mins = sys.argv[2]
date = datetime.date.today()
ori_file = '/Users/kimheungbeom/Dropbox/ebs/temp' + str(date) + '_' + program_name
m4a_file = '/Users/kimheungbeom/Dropbox/ebs/ebs' + str(date) + '_' + program_name + '.m4a'
rtmpdump = ['rtmpdump', '-r', radio_addr, '-B', record_mins, '-o', ori_file]
ffmpeg = ['ffmpeg', '-i', ori_file, '-vn', '-acodec', 'copy', m4a_file]
rm = ['rm', '-rf', ori_file]
p = subprocess.Popen(rtmpdump)
p.communicate()
p = subprocess.Popen(ffmpeg)
p.communicate()
p = subprocess.Popen(rm)
p.communicate()
if __name__ == "__main__":
recording()
答案 0 :(得分:0)
尝试具体说明您的python版本的位置以及脚本在crontab条目中的位置。
30,0 * * * * /path/to/python /path/to/your/script