On 15/06/18 21:59, Dennis Lee Bieber wrote:
> On Fri, 15 Jun 2018 16:06:07 +0100, RobH declaimed the
> following:
>
>
>> I'm not sure what you mean about RAMname and NASName
>>
>> RAMname = os.path.join("/run/shm", fname)
>> NASname = os.path.join("/mnt/CCTV/PiZero" , fname)
>>
>
> My full suggestion was to change the camera capture statement (which
> was using RAMname) to directly use NASname. THEN comment out the
> shutil.copyfile() and the unlink() -- since the camera is no longer
> creating the local RAM data file.
>
> As long as the network speed is fast enough, those changes would mean
> the capture file is directly generated in the NAS (or the camera capture
> itself will fail with permission problems -- again, ignoring the script,
> unless you can copy files from your home directory to /mnt/CCTV/PiZero
> without getting an error, the script is not going to succeed.
>
>
I have done a couple of changes to the script earlier, as I did a bit of
reading about shutil and moving files.
src = join('/', RAMname) #new lines here
dst = join('/', NASname)
The script has been running for about 2 hours with no errors, and only a
0 byte file moved over the the NAS box.
I commented those 2 lines out and used this as you have suggested:
#camera.start_recording(RAMname)
camera.start_recording(NASname)
#shutil.copyfile(RAMname, NASname)
#os.unlink(RAMname)
Is that what you meant, above.
Running the script now produces:
pi@raspberrypi:~/Downloads $ python intruder.py
Traceback (most recent call last):
File "intruder.py", line 37, in
camera.start_recording(NASname)
File "/usr/lib/python2.7/dist-packages/picamera/camera.py", line
1049, in start_recording
encoder.start(output, options.get('motion_output'))
File "/usr/lib/python2.7/dist-packages/picamera/encoders.py", line
812, in start
super(PiVideoEncoder, self).start(output)
File "/usr/lib/python2.7/dist-packages/picamera/encoders.py", line
375, in start
self._open_output(output)
File "/usr/lib/python2.7/dist-packages/picamera/encoders.py", line
331, in _open_output
self.outputs[key] = mo.open_stream(output)
File "/usr/lib/python2.7/dist-packages/picamera/mmalobj.py", line
344, in open_stream
stream = io.open(stream, 'wb' if output else 'rb', buffering)
IOError: [Errno 13] Permission denied:
'/mnt/CCTV/PiZero/2018-06-15_23.04.43.h264'
I have done a bit of reading up on shutil
http://www.pythonforbeginners.com/os/python-the-shutil-module
and have tried this
src = join('/', RAMname) #new lines here
dst = join('/', NASname)
I realise that the modification may well only guess work, but it doesn't
produce errors.
The script runs without errors, but again the files produced from the
script are only 0 bytes in size on my NAS box, and no files were written
to the PIZero.
On the question of moving or transferring files from the PiZero to my
NAS box, I can move the test junk file over, so that part seems to work ok.
--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)
|