Python Forum
Error when running mktorrent subprocess command
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error when running mktorrent subprocess command
#2
The first argument to subprocess.run is the list of arguments. You're not passing them as a list. The second argument (optional) is bufsize. Your second argument of '-vp' isn't an integer, so it complains about it at that point.

#Incorrect
subprocess.run('/bin/ls', 'myfile')
#Correct
subprocess.run(['bin/ls', 'myfile'])

Also, you can't enter the elif sections unless you've failed the previous if/elifs. So for instance in the first elif, you already know that filesize must be < 16, so you don't have to check for it again.

# Equivalent to above:
if filesize_gb >= 16:
    piece_size = 24
elif filesize_gb >= 8:
    piece_size = 23
elif filesize_gb >= 4:
    piece_size = 22
elif filesize_gb >= 2:
    piece_size = 21
...
Reply


Messages In This Thread
RE: Error when running mktorrent subprocess command - by bowlofred - Sep-14-2020, 10:05 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  error "cannot identify image file" part way through running hatflyer 0 846 Nov-02-2023, 11:45 PM
Last Post: hatflyer
  error: invalid command 'egg_info' TimTu 0 1,089 Jul-27-2023, 07:30 AM
Last Post: TimTu
  Error when running kivy on python janeik 8 2,350 Jun-16-2023, 10:58 PM
Last Post: janeik
  Using subprocess to execute complex command with many arguments medatib531 5 2,267 Apr-27-2023, 02:23 PM
Last Post: medatib531
  Running script with subprocess in another directory paul18fr 1 4,501 Jan-20-2023, 02:33 PM
Last Post: paul18fr
  Command error - cursor.executemany(comandoSQL,valoresInserir) TecInfo 2 1,504 Nov-18-2022, 01:57 PM
Last Post: TecInfo
  Getting error when running "MINUS" between 2 databases marlonbown 4 1,430 Nov-10-2022, 05:49 AM
Last Post: deanhystad
  Error while running code on VSC maiya 4 4,101 Jul-01-2022, 02:51 PM
Last Post: maiya
  Pandas - error when running Pycharm, but works on cmd line zxcv101 1 1,445 Jun-18-2022, 01:09 PM
Last Post: snippsat
  Error when running a matplot lib example aurelius_nero 3 7,349 Apr-24-2022, 01:24 PM
Last Post: Axel_Erfurt

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020