@barsanuphe
I think all my problems related to LibrarianSync is because I synced git repo from Windows system so git added nasty ^M at the end of each line ..
I ran today few hours ago 'Export Collections function' and it ran for over 10 hours.
So I thought it was something wrong and decided to run same command through the ssh..
I had in the terminal something like:
after editing generate_collections.py to make sure it's /usr/bin/env python instead of /usr/bin/env python2.7 it worked .. and was done after 38.52s...
I'm gonna test your script now for creating collections.json file on localhost.. and report back.. sorry for longness!