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
#3
Thanks for the response.

To address the first part, I should be able to just add the brackets around the list of arguments, right?
subprocess.run(['mktorrent', '-vp', '-s', 'HUH', '-l', piece_size, '-a', 'https://sometracker.org/announce.php', target_file, '-o', torrent_name, final_dest])
With that change, I'm now receiving the following error:
Error:
Traceback (most recent call last): File "C:\Users\REMOVED\python_apps\my_progs\create_torrent\create_torrent.py", line 39, in <module> subprocess.run(['mktorrent', '-vp', '-s', 'HUH', '-l', piece_size, '-a', 'https://sometracker.org/announce.php', target_file, '-o', torrent_name, final_dest]) File "C:\Users\REMOVED\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py", line 489, in run with Popen(*popenargs, **kwargs) as process: File "C:\Users\REMOVED\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py", line 854, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "C:\Users\REMOVED\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py", line 1247, in _execute_child args = list2cmdline(args) File "C:\Users\REMOVED\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py", line 549, in list2cmdline for arg in map(os.fsdecode, seq): File "C:\Users\REMOVED\AppData\Local\Programs\Python\Python38-32\lib\os.py", line 818, in fsdecode filename = fspath(filename) # Does type-checking of `filename`. TypeError: expected str, bytes or os.PathLike object, not int
The only integer in the command is piece_size. Does this mean that there's an issue with the command argument order? I was hoping to avoid that by verifying the expected command worked in cmd.

Your elif block suggestion is great. Thank you!
Reply


Messages In This Thread
RE: Error when running mktorrent subprocess command - by pythonnewbie138 - Sep-16-2020, 01:23 AM

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