I'm trying to run a shell command but the stdout is empty:
import subprocess
torrentno=8
cmd="/usr/bin/transmission-remote --torrent %s --info", str(torrentno)
res=subprocess.run(cmd, shell=True, check=True, universal_newlines=True,
capture_output=True)
print(res)
CompletedProcess(args=('/usr/b
On Wednesday, January 19, 2022 at 11:08:58 PM UTC-5, Dennis Lee Bieber wrote:
> Don't you need to provide for that %s? Perhaps
>
> cmd="/usr/bin/transmission-remote --torrent %s --info" % torrentno
That works, thanks.
--
https://mail.python.org/mailman/listinfo/python-list
On Wednesday, January 19, 2022 at 11:14:28 PM UTC-5, cameron...@gmail.com wrote:
> But I recommend you use shell=False and make:
>
> cmd = ["/usr/bin/transmission-remote", "--torrent", str(torrentno), "--info"]
I like that. :-)
--
https://mail.python.org/mailman/listinfo/python-list
I tried:
dt=+"{:02d}".format(day)
but I got:
dt=+"{:02d}".format(day)
TypeError: bad operand type for unary +: 'str'
This works:
dt=dt+"{:02d}".format(day)
Why can't I do the shortcut on strings?
--
https://mail.python.org/mailman/listinfo/python-list
Say an object like this exists:
class test:
a = ""
b = ""
You pickle it.
You change the object definition to have a new field:
class test
a = ""
b = ""
c = ""
You read the pickled object.
Will it load but ignore the new field?
That is what I want.
--
https://mail.python.org/
I can't get this to work.
It runs but there is no output when I try it on a file.
#!/usr/bin/python
import os
import sys
import re
from datetime import datetime
#logDir = '/nfs/projects/equinox/platformTools/RTLG/RTLG_logs';
#os.chdir( logDir );
programName = sys.argv[0]
fileName = sys.argv[1]
On Wednesday, March 26, 2014 11:23:29 PM UTC-4, James Smith wrote:
> I can't get this to work.
>
> It runs but there is no output when I try it on a file.
>
>
>
>
>
> #!/usr/bin/python
>
>
>
> import os
>
> import sys
>
> import
On Thursday, March 27, 2014 1:32:03 AM UTC-4, Steven D'Aprano wrote:
> - are you mistaken about the content of the file?
>
> I can't help you with the first. But the second: try running this:
>
> # line2 and pat as defined above
> filename = sys.argv[1]
> with open(filename) as f:
> for line
On Thursday, March 27, 2014 9:41:55 AM UTC-4, James Smith wrote:
> (134, False, '\'
> "SHELF-17:LOG_COLN_IP,SC,03-25,01-18-58,NEND,NA,,,:"Log Collection In
> Progress",NONE:170035-6364-1048,:YEAR=2014,MODE=NONE"\\r\\n\'')
>
&g
I want the last "1"
I can't this to work:
>>> pattern=re.compile( "(\d+)$" )
>>> match=pattern.match( "LINE: 235 : Primary Shelf Number (attempt 1): 1")
>>> print match.group()
--
https://mail.python.org/mailman/listinfo/python-list
10 matches
Mail list logo