•  » Extensions
  •  » Getting Piwigo import Tree working

#1 2020-11-28 09:06:22


Getting Piwigo import Tree working


I was having problems getting the 'Piwigo import tree' tool working and thought I'd post the steps I took and what I discovered.

A fresh Linux mate installation has Perl installed by default.  But running the scipt I got :


Can't locate in @INC (you may need to install the JSON module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.30.0 /usr/local/share/perl/5.30.0 /usr/lib/x86_64-linux-gnu/perl5/5.30 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.30 /usr/share/perl/5.30 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at line 30.

To fix that I ran


sudo cpan JSON

After that, the script complained about


Can't stat my photos directory: No such file or directory

It wasn't clear to be that the directory that the script expects is not the destination album but rather the source directory where the photos are being copied from.  Note that a trailing slash is important.  Without it I got the message


album "Copies-to-upload" must be created

So my command became:


perl --base_url=  --user=myusername  --password=xxxxx  --directory="/data/Photos_Video/Copies-to-upload/"

Now for the final problem.  It kept uploading one file then failing at


cannot open file "Copies-to-upload/.piwigo_import_tree.txt" for writing at line 465.

Thinking this was a file permissions issue I tried various directories, changing permissions to 777 and even running it with sudo.  I finally found this post which has a link to the solution - I changed script lines 463 & 513 as Richard suggested.  Started working!

Pierrick[plg]: Thanks VERY much for the script.  FYI, I was getting the error with no existing '.piwigo_import_tree.txt' file.  I even tried creating an empty file


touch .piwigo_import_tree.txt

but I still got the same "cannot open file for writing" error. 

Usage notes:
The script seems to create the hidden file '.piwigo_import_tree.txt' in each of the (sub)directories.  It writes the name of any file uploaded during that run.  It seems that this file can be safely deleted without any issues - any files already uploaded are not uploaded again on subsequent runs.  You just loose the record of files that have previously been uploaded.

I'm still trying to work out what all of the optional parameters are supposed to do - the documentation for this tool doesn't really specify as far as I can see.

Hope this helps someone else.

Running Linux mint 20 mate
Piwigo import tree V1.0
piwigo version ??? (whatever is running)


  •  » Extensions
  •  » Getting Piwigo import Tree working

Board footer

Powered by FluxBB

github twitter newsletter Donate © 2002-2023 · Contact