0

I'm trying to make a rng from this website: http://jamesdotcom.com/?p=417. However when I run the following code:

captureImage = subprocess.Popen(
   [
       "fswebcam", "-r", "356x292", "-d", "/dev/video0", 
       "static.jpg", "--skip", "10"
   ], 
   stdout=devNull, stderr=devNull)
captureImage.communicate()

I get the following error message:

NameError: name 'subprocess' is not defined

What should I do? Thanks

JuniorCompressor
  • 19,631
  • 4
  • 30
  • 57
Neil Sehgal
  • 9
  • 1
  • 2

1 Answers1

4

Have you imported it first?

import subprocess
captureImage = subprocess.Popen(["fswebcam", ...)

Subprocess is included in Python standard library since Python 2.4. It should not be necessary to install it.

Messa
  • 24,321
  • 6
  • 68
  • 92
  • I imported it and it says NameError: name 'devNull' is not defined. What should I do? – Neil Sehgal Mar 17 '15 at 00:09
  • @NeilSehgal Please look at the full source code at the end of that blogpost you linked. There is `devNull = open('/dev/null', 'w')`. – Messa Mar 17 '15 at 00:39