Packaging Supporting files for plugin

picard
picardplugins
picard-plugin-development
Tags: #<Tag:0x00007f6d79e861e0> #<Tag:0x00007f6d79e86000> #<Tag:0x00007f6d79e85e70>
#1

I have written a Picard plugin the uses a supporting CSV file to help implement its functionality. How do I package the file along with my plugin script? I see some plugins are zip files but couldn’t get Picard to load a zip file I created myself. I tried pulling the latest 2.0 plugin branch from github, adding my plugin and file, and running generate.py, but it crapped out after adding the bpm plugin. (I removed my file from the folder to be sure it wasn’t mine causing the problem. I can reproduce it with a fresh pull from git). Finally, once I do manage to package the supporting file with my plugin, what path will I use to access it from within my plugin?
Sorry for all the questions but this is new to me and the docs are basically non existent in this area.

0 Likes

#2

It sounds like the zip format is your best solution. Some things to note…

  1. the zip file must be named for your plugin (e.g.: my_plugin.zip)
  2. the zip file must contain all files in a directory which is named for your plugin (e.g.: /my_plugin/)
  3. the name of your main python file that is called must be __init__.py

For example, the contents of your my_plugin.zip file might be something like:

/my_plugin/__init__.py
/my_plugin/my_plugin_ui.py
/my_plugin/data/my_plugin_data.csv

Have a look at my Format Performer Tags plugin or Language Name plugin for a working example.

1 Like

#3

Awesome thanks. I’ll give it a try.

0 Likes

#4

I must not be holding my head just right. I have tried this numerous ways and get either no error message (and no load) or “Failed loading zipped plugin classical_fixes” every time.

I have a file classical_fixes.py that contains my plugin. If I load this file directly, it loads fine.
If I rename the file to init.py and try to load it directly, it doesn’t load and I get no error message.
If I put the file in to zip file called classical_fixes with a directory structure /classical_fixes/init.py, I get the error message about
If I rename the file BACK to classical_fixes.py and put it in a similiar zip file it also fails.

Any help is appreciated. I have no idea what’s happening and the debug load is effectively worthless at providing additional information.

0 Likes

#5

If the files are available for download somewhere I can try to package them for you and see if I can get it to work for you.

EDIT: I found your repository on GitHub (https://github.com/dpetit12345/classical_fixes), renamed and packaged the files, and created a pull request to provide the package. I tried it here and it loads fine into Picard. I didn’t check the actual workings or closely review the code, but I did find one hard coded reference to e:/artists.csv which I suspect will cause problems for most users.

2 Likes