python - bufsize must be an integer error while grepping a message -


i running following error while trying grep message consisting of multipe lines in log...can provide inputs on how overcome error?

code:-

    print gerrit_commitmsg     gerritlog = popen('git','log','--grep','gerrit_commitmsg', stdout=pipe, stderr=pipe)     print gerritlog 

error:-

commit message:-  build system changes  build system changes include packages in build  change-id: i697558f01ae367d2baacdf2c7fcf1a03753edacd  traceback (most recent call last):   file "gerrits_in_workspace.py", line 87, in <module>     main()   file "gerrits_in_workspace.py", line 77, in main     grep_commitmsg(gerrit_commitmsg)   file "gerrits_in_workspace.py", line 48, in grep_commitmsg     gerritlog = popen('git','log','--grep','gerrit_commitmsg', stdout=pipe, stderr=pipe)   file "/usr/lib/python2.7/subprocess.py", line 629, in __init__     raise typeerror("bufsize must integer") 

the subprocess.popen class expects argument list this:

popen(args, bufsize=0, ...) 

so you're passing it:

  • args = git
  • bufsize = log

hence error (bufsize expects integer value). command vector needs list, this:

gerritlog = popen(['git','log','--grep','gerrit_commitmsg'], stdout=pipe, stderr=pipe) 

Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -