ftp causing invalid syntax

Apologies for late reply, as I did not realise you had replied to me.

I had a problem with the piZero booting as it said the shell is locked, so I just re burned the stretch image on the sd card and starting over again.

As before I have managed to get this far:

I ran this: echo "test" > /mnt/CCTV/PiZero/test.txt and the file was created on my NAS box in the PiZero directory

sudo mount //192.168.0.22/CCTV/PiZero /mnt/CCTV/PiZero -o username=root,password=*******

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 2] No such file or directory: '//192.168.0.22/mnt/CCTV/PiZero/2018-06-04_15.09.19.h264'

On the PiZero I have: /mnt/CCTV/PiZero

When I run this: sudo mount -t cifs -o //192.168.0.22/mnt/CCTV/PiZero /mnt/CCTV/PiZero mount: can't find /mnt/CCTV/PiZero in /etc/fstab

Now as far as I am aware, there was nothing about fstab before, so do you think I should add the said line in /etc/fstab.

Thanks

Now no files of any size are created when I run the python script.

Reply to
RobH
Loading thread data ...

You most likely don't want the first /mnt

so

assuming the actual folder /CCTV/PiZero exists on the NAS and the empty mount-point /mnt/CCTV/PiZero exists on the rPi.

try

sudo mount -t cifs -o //192.168.0.22/CCTV/PiZero /mnt/CCTV/PiZero

Forget running the script until you can create non-zero length files on one machine, and see the contents of them on the other machine, preferably both ways round.

Reply to
Andy Burns

That returns this:

sudo mount -t cifs -o //192.168.0.22/CCTV/PiZero /mnt/CCTV/PiZero mount: can't find /mnt/CCTV/PiZero in /etc/fstab pi@raspberrypi:~ $

I think/reckon that something should be added to the /etc/fstab file along the lines of /mnt/CCTV/PiZero or the full line from //192.168.0.22 etc

Reply to
RobH

What's that -o doing in there ? Unless I'm much mistaken it's turning the //192.168.0.22/mnt/CCTV/PiZero into an option which would probably cause an error (unsupported option or somesuch) except that since mount can't see a special it goes looking in fstab for the mountpoint and fails to find it and so bombs out with that error instead.

--
Steve O'Hara-Smith                          |   Directable Mirror Arrays 
C:\>WIN                                     | A better way to focus the sun 
The computer obeys and wins.                |    licences available see 
You lose and Bill collects.                 |    http://www.sohara.org/
Reply to
Ahem A Rivet's Shot

Still the same error without the-o

sudo mount -t cifs //192.168.0.22/CCTV/PiZero /mnt/CCTV/PiZero Password for root@//192.168.0.22/CCTV/PiZero: ******

pi@raspberrypi:~ $ python intruder.py Traceback (most recent call last): File "intruder.py", line 40, in shutil.copyfile(RAMname, NASname) File "/usr/lib/python2.7/shutil.py", line 83, in copyfile with open(dst, 'wb') as fdst: IOError: [Errno 2] No such file or directory: '//192.168.0.22/CCTV/PiZero/2018-06-04_17.47.17.h264'

pi@raspberrypi:~ $

Reply to
RobH

you might eventually want an entry in the /etc/fstab to it can be mounted automatically, or with a "mount -a" command, but get the mount to work manually first.

Does /CCTV/PiZero exist on the NAS, is it exported by samba or some other CIFS server?

Does /mnt/CCTV/PiZero exist on the rPI

All case sensitive.

Reply to
Andy Burns

Forget the script until the mount works!

Reply to
Andy Burns

Ok will do for now then.

I have just been reading up on shutil here:

formatting link

Reply to
RobH

That bit in the script should read /mnt/CCTV/PiZero.

-- Steve O'Hara-Smith | Directable Mirror Arrays C:\>WIN | A better way to focus the sun The computer obeys and wins. | licences available see You lose and Bill collects. |

formatting link

Reply to
Ahem A Rivet's Shot

This worked fine just now:

pi@raspberrypi:~ $ sudo mount //192.168.0.22/CCTV/PiZero /mnt/CCTV/PiZero Password for root@//192.168.0.22/CCTV/PiZero: ******

I have added this in the fstab file:

192.168.0.22:/mnt/CCTV/PiZero /mnt/CCTV/PiZero

/CCTV/PiZero exists on my NAS box, and /mnt/CCTV/PiZero exist on the PiZero.

So as the mount works now, and is in the fstab file, it now points to the python script:

NASname = os.path.join("//192.168.0.22/mnt/CCTV/PiZero" , fname)

Reply to
RobH

The mount works fine now:

pi@raspberrypi:~ $ sudo mount //192.168.0.22/CCTV/PiZero /mnt/CCTV/PiZero Password for root@//192.168.0.22/CCTV/PiZero: ****** pi@raspberrypi:~ $

Reply to
RobH

hurrah :-)

^^^^ where did that creep back from?

once it's mounted you just use the local path you mounted it at

os.path.join("/mnt/CCTV/PiZero", fname)

Reply to
Andy Burns

Does os.path.join("/mnt/CCTV/PiZero", fname) have to be added underneath NASname= os.path.join etc.

Oh I removed the first /mnt in the fstab file, and now I have big problem. The shell is locked again.

Reply to
RobH

With python's finicky indenting, no, keep it on one line similar to your original, but without the //192.168.0.22 bit

NASname = os.path.join("/mnt/CCTV/PiZero", fname)

ctrl-C ?

Reply to
Andy Burns

The fstab file didn't seem to have the correct information into and consequently the PiZero failed to boot up. I then had to re flash the sd card.

Now I have successfully mounted the /mnt/CCTV/Pizero as it shows up here:

pi@raspberrypi:~ $ df -h Filesystem Size Used Avail Use% Mounted on Other information edited out /dev/sda1 7.5G 16K 7.5G 1% /media/pi/B00F-4173 //192.168.0.22/CCTV/PiZero/ 899G 3.5G 896G 1% /mnt/CCTV/PiZero pi@raspberrypi:~ $

Now the sensor has stopped working for some unknown reason, maybe a capacitor has been bent over to much whilst I was fiddling with the PiZero connections.

Reply to
RobH

As previously, I have again successfully mounted the /mnt/CCTV/PiZero directory, and the sensor and the new camera are working just fine.

pi@raspberrypi:~/Downloads $ df -h Filesystem Size Used Avail Use% Mounted on /dev/root 15G 4.1G 9.9G 30% / /dev/mmcblk0p1 42M 21M 21M 51% /boot tmpfs 38M 4.0K 38M 1% /run/user/1000 //192.168.0.22/CCTV/PiZero/ 899G 2.7G 897G 1% /mnt/CCTV/PiZero pi@raspberrypi:~/Downloads $

When I run pi@raspberrypi:~/Downloads $ python intruder.py, it returns this:

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 2] No such file or directory: '//192.168.0.22/mnt/CCTV/PiZero/2018-06-13_19.52.59.h264'

Relevant portion of code where it falls over, as above

#create base filename at time of motion trigger fname = time.strftime("%Y-%m-%d_%H.%M.%S.h264", time.localtime(triggerTime))

RAMname = os.path.join("/run/shm", fname) NASname = os.path.join("//192.168.0.22/mnt/CCTV/PiZero" , fname)

camera.start_preview()

#capture video to RAM device first camera.start_recording(RAMname) camera.wait_recording(10) camera.stop_recording() camera.stop_preview()

#copy from RAM device to NAS device shutil.copyfile(RAMname, NASname)

Reply to
RobH

On Wed, 13 Jun 2018 20:03:38 +0100, RobH declaimed the following:

And as you've been repeatedly told, the path in NASname is supposed to be the location in the RPi where you put the mount point. It is NOT supposed to be a reference to the remote device itself.

Presuming the mount point ON THE RPi is /mnt/CCTV/PiZero then THAT is what you want in that .join() operation. Take out the //192.168.0.22

^^^^^^^^^^ physical location path to access it ^^^^^^^^^^^

^^^^^^^^^^ physical location path to access it ^^^^^^^^^^^

--
	Wulfraed                 Dennis Lee Bieber         AF6VN 
	wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/
Reply to
Dennis Lee Bieber

Thanks and it took a while to get to sink in: Doh!

Now it's permissions problems, and I have googled how to change permissions on file and folders, but no joy as yet.

I have tried:

pi@raspberrypi:/mnt $ sudo chown -R 777 /mnt/CCTV pi@raspberrypi:/mnt $ sudo chown -R 777 /mnt pi@raspberrypi:/mnt $ sudo chown -R 777 /mnt/CCTV pi@raspberrypi:/mnt $ sudo chown -R 777 /mnt/CCTV/PiZero/ pi@raspberrypi:/mnt $ pi@raspberrypi:/mnt $ ls -l total 4 drwxr-xr-x 3 777 root 4096 Jun 5 09:50 CCTV

Then ran the python script and got the permissions problem again

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-14_10.12.34.h264'

In PiZero's file manager the folders /CCTV and /PiZero have their read and write permission set for anyone, but the /mnt directory is not.

I tried:

pi@raspberrypi:~ $ cdmod -R a+rX /mnt

-bash: cdmod: command not found pi@raspberrypi:~ $ chmod -R a+rX /CCTV/Pizero chmod: cannot access '/CCTV/Pizero': No such file or directory pi@raspberrypi:~ $

Thanks

Reply to
RobH

On Thu, 14 Jun 2018 12:04:01 +0100, RobH declaimed the following:

Unless you have a user named "777" those parameters are wrong.

formatting link
""" The basic syntax for using chown to change owners is

chown [options] new_owner object(s) """

^^^ ^^^^

^^^ user name ^^^^ group name

Try

chown -R pi /mnt/CCTV

Or (untried) create a new group (call it NASuser), chown the mount point to that group, and then add pi user to the new group.

That 777 looks like you are trying to set permission levels (the rwx stuff you see on the left). That command is chmod

formatting link

--
	Wulfraed                 Dennis Lee Bieber         AF6VN 
	wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/
Reply to
Dennis Lee Bieber

you should have done chmod - not chown with those params

--
--
Reply to
Björn Lundin

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.