I put together a little Python program [0][1] to email bugs assigned to bug wranglers and it works fine from the command line. When I try to run it from a cron it is looking for /bin/stty to determine the column's and row's. I will paste the error below. [0] http://linuxcrazy.pastebin.com/f29276362 [1] http://linuxcrazy.pastebin.com/f5f84c6c7 Reproducible: Always Traceback (most recent call last): File "/usr/bin/bugz", line 4, in <module> bugz.main() File "/usr/lib64/python2.5/site-packages/bugz.py", line 1761, in main bugz = PrettyBugz(**bugz_kwds) File "/usr/lib64/python2.5/site-packages/bugz.py", line 1199, in __init__ self.columns = columns or get_cols() File "/usr/lib64/python2.5/site-packages/bugz.py", line 321, in get_cols rows, cols = map(int, row_cols.split()) ValueError: invalid literal for int() with base 10: '/bin/stty:'
Here is the program, forgot and left my password in it. http://linuxcrazy.pastebin.com/f37cba8ee
do not post links to external sites (*especially* ones like pastebin) post *all* information into your report
OK, Here is the program; #!/usr/bin/python # Filename: bug_wrangler.py from subprocess import call import smtplib, sys, MimeWriter, StringIO, base64 import os def get_bugzs(): searchbugz ='/usr/bin/searchbugz' call([searchbugz]) def mail(serverURL=None, port=None, sender='', to='', subject='', text=''): """ Usage: mail('smtp.gmail.com', 587, 'me@gmail.com', 'to@someone.com', 'Bug Wranglers', 'Current Bugs:') """ message = StringIO.StringIO() writer = MimeWriter.MimeWriter(message) writer.addheader('Subject', subject) writer.startmultipartbody('mixed') # start off with a text/plain part part = writer.nextpart() body = part.startbody('text/plain') body.write(text) # now add an attachment part = writer.nextpart() part.addheader('Content-Transfer-Encoding', 'base64') body = part.startbody('text/plain') base64.encode(open('/tmp/bugz.txt', 'rb'), body) # finish off writer.lastpart() # send the mail smtp = smtplib.SMTP('smtp.gmail.com', 587) smtp.ehlo() smtp.starttls() smtp.ehlo() smtp.login('me@gmail.com', 'passwd') smtp.sendmail(sender, to, message.getvalue()) smtp.quit() if __name__ == "__main__": get_bugzs() mail('smtp.gmail.com', 587, 'me@gmail.com','to@someone.com', 'Bug Wranglers', 'Current Bugs:') Here is searchbugz; #!/bin/bash /usr/bin/bugz search -a bug-wranglers@gentoo.org > /tmp/bugz.txt Here is the entry in /etc/cron.daily as getbugz; #!/bin/bash /usr/bin/bug_wrangler.py
Hi David, can you test this against pybugz-0.7.4_rc1 and let me know if itt has been fixed there? Thanks, William
Hi William, Now it is looking for a username: david [03:22 PM] opteron ~ $ bugz search --assigned-to bug-wranglers@gentoo.org > /tmp/bugz.txt * Using https://bugs.gentoo.org/ * Searching for bugs with the following options: * assigned_to = bug-wranglers@gentoo.org * No username given. Username: I changed it to: david [10:02 PM] opteron ~ $ cat /usr/bin/searchbugz #!/bin/bash /usr/bin/bugz search -u david@linuxcrazy.com -p mypasswd -a bug-wranglers@gentoo.org > /tmp/bugz.txt Thanks William, Works Perfect, here is the mail; Current Bugs: * Using https://bugs.gentoo.org/ * Searching for bugs with the following options: * assigned_to = bug-wranglers@gentoo.org 264412 bug-wranglers app-text/pdftk-1.12 - gcjh Engine; Exception in th 264417 bug-wranglers cross-compiling dev-libs/icu-3.8.1-r1 fails 264645 bug-wranglers x11-base/xorg-server-1.4.2 - Xdmx: pointer stuck i 264728 bug-wranglers revdep-rebuild from app-portage/gentoolkit-0.2.4.2 264755 bug-wranglers crossdev: arm comes with thumb, but without interw <snip>