So I have a file that looks like so:
#!/usr/bin/python
import MySQLdb
import subprocess
from subprocess import call
import re
conx = MySQLdb.connect (user = 'root', passwd = '******', db = 'vaxijen_antigens')
cursor = conx.cursor()
cursor.execute('select * from sequence')
row = cursor.fetchall()
f = open('/home/rv/ncbi-blast-2.2.23+/db/vdatabase.fasta', 'w')
for i in row:
f.write('>'+i[0].strip()+'\n')
s = re.sub(r'[^\w]','',str(i[1]))
s = ''.join(s)
for k in range(0, len(s), 60):
f.write('%s\n' % (s[k:k+60]))
f.write('\n')
f.close()
subprocess.call(['formatdb', '-p', 'T', '-i', r'/home/rv/ncbi-blast-2.2.23+/db/vdatabase.fasta'])
The file runs no problem from the command line but when I try and run it with crontab I get this error:
File "/home/rv/ncbi-blast-2.2.23+/db/formatdb.py", line 29, in <module>
subprocess.call(['formatdb', '-p', 'T', '-i',
r'/home/rv/ncbi-blast-2.2.23+/db/vdatabase.fasta'])
OSError: [Errno 2] No such file or directory
I don't understand, the file exist in that directory, I've double and triple checked. I tried converting the file path to a raw string hence the lower case "r" before the path but that didn't do it either.