Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 1585

Python • Re: Datetime Code Not Working

$
0
0
TypeError: send_command() takes 1 positional argument but 3 were given.

Code:

send_command("Export2: Filename=/home/pi/raspberrypi/", current_time, ".mp3")
Seems to me you need to turn those three items into a single string. I would use -

Code:

send_command("Export2: Filename=/home/pi/raspberrypi/{}.mp3".format(current_time))
Others might prefer - note the prefixed 'f' for the string -

Code:

send_command(f"Export2: Filename=/home/pi/raspberrypi/{current_time}.mp3")

Statistics: Posted by hippy — Thu Mar 14, 2024 12:27 pm



Viewing all articles
Browse latest Browse all 1585

Trending Articles