On 15/06/18 16:06, RobH wrote:
> On 15/06/18 15:01, Dennis Lee Bieber wrote:
>> On Fri, 15 Jun 2018 14:47:54 +0100, RobH declaimed
>> the
>> following:
>>
>>> When I commented out shutil and RAMxxx to NAsxxx, the script ran fine
>>> and took a video. When I then removed the comment from shutil and ran
>>> the script again, there was an error:
>>>
>>
>> If you actually implemented what I was describing, the camera file
>> should be created directly on the NAS via the mount point, and you do not
>> want to try copying or deleting what results.]
>>
>>> pi@raspberrypi:~/Downloads $ python intruder.py
>>> Traceback (most recent call last):
>>> File "intruder.py", line 37, in
>>> shutil.copyfile(RAMname, NASname)
>>> File "/usr/lib/python2.7/shutil.py", line 83, in copyfile
>>> with open(dst, 'wb') as fdst:
>>> IOError: [Errno 13] Permission denied:
>>> '/mnt/CCTV/PiZero/2018-06-15_14.40.14.h26
>>>
>>> This was picked up by the unlink line commented out, or however you
>>> would say it
>>> And a 0 byte file is copied to my NAS /PiZero directory.
>>>
>>
>> Which sounds like it is creating the file entry in the directory,
but
>> not copying data... But, again, if you made the changes I suggested,
>> there
>> is no file in "RAMname" to be copied, and the file in "NASname" should
>> already exist (I don't know if copyfile() can replace an existing file).
>
> 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)
>
>>
>>> Now when I un commented out the unlink line, the script ran without
>>> error, and a video was written to the /mnt/CCTV/Pizero directory on the
>>> PiZero. No file was copied or moved to my NAS box PiZero directory
>>
>> If the mount command worked, then "/mnt/CCTV/Pizero" (is that
correct
>> -- Linux is case sensitive and in other places you use "PiZero"?) and the
>> NAS "PiZero" ARE THE SAME PHYSICAL DIRECTORY; any change in one should
>> appear in the other. At worst you might have to refresh any directory
>> display to see the changes (if you are using a GUI or web interface to
>> view
>> the NAS).
>>
>>
>
> Oops it was a typo, and is and should be PiZero
>
> On my Ubuntu machine I open file manager or whatever it is called, the
> other locations and smb to my NAS box. From there I select the dataset
> or folder, which in this case is PiZero. When I have finished doing what
> I want I then close down file manager. So I view my NAS box in file manager
I just tried the script again and it is now failing with Permissions
denied again, aargh!!!
pi@raspberrypi:~/Downloads $ python intruder.py
Traceback (most recent call last):
File "intruder.py", line 37, in
shutil.copyfile(RAMname, NASname)
File "/usr/lib/python2.7/shutil.py", line 83, in copyfile
with open(dst, 'wb') as fdst:
IOError: [Errno 13] Permission denied:
'/mnt/CCTV/PiZero/2018-06-15_17.23.59.h264'
The permissions for all the directories have not changed.
The shutil line was not commented out in this case.
I commented the shutil line again and ran the script. This time no
errors and a 0 byte file was created on both the PiZero and my NAS box
PiZero directory.
A strange thing is that selecting properties of a video file says it is
0 bytes, but in the bottom bar of file mangler, it says it is 5.1 MiB.
--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)
|