0

I want to make a display for my raspberry pi that shows the day of the week, day of the month, the abbreviated month, and the current time. Here is the current code I am trying to run:

import subprocess

cmd = "date +"%a %b %d %r""
date = subprocess.check_output(cmd, shell=True)

But I am getting this error:

Traceback (most recent call last):
  File "/home/jc-yeti/oled3.py", line 3, in <module>
    cmd = "date +"%a %b %d %r""
NameError: name 'a' is not defined

When I run the same command in the terminal it works just fine, what am I missing?

mkrieger1
  • 19,194
  • 5
  • 54
  • 65

0 Answers0