Kodi Plugin structure is incorrect - python

I'm having a trouble packaging Kodi plugin under MAC. I took as an example a simple video plugin and wanted to start with a simple renaming before doing further development. At this stage, import of plugin constantly fails when I do
Install from Zip in Kodi
I've resolved all issue related to specific MAC zip content, by writing my own python ZIP script, which omits all MAC related files. Thus, now I can unzip and zip a working plugin and successfully import it in Kodi. However, i'm still having Addon does not have correct structure.
Here is a link to my custom plugin.
What strikes me the most is that simple renaming causes all these issues. You might know any debugging tool for Kodi plugins? I will greatly appreciate any assistance, since I have put already 3 days in it.
Thanks!

Eventually, there seems to be a bug in Kodi, whenever you try to load a plugin with an incorrect structure, all subsequent loads will fails as well, even if the structure the updated plugin is correct. You should restart KODI to resolve this.
Cheers!

Related

How do I make a macOS app out of my Python program?

I've made this question because I had to go through the whole process of creating my own application using Apple's somewhat lacking documentation, and without the use of py2app. I wanted to create the whole application structure so I know exactly what was inside, as well as create an installer for it. The latter of these is still a mystery, so any additional answers with information on making a custom installer would be appreciated. As far as the actual "bundle" structure goes, however, I think I've managed to get the basics down. See the answer below.
Edit: A tutorial has been linked at the end of this answer on using PyInstaller; I don't know how much it helps as I haven't used it yet, but I have yet to figure out how to make a standalone Python application without the use of a tool like this and it may just be what you're looking for if you wish to distribute your application without relying on users knowing how to navigate their Python installations.
A generic application is really just a directory with a .app extension. So, in order to build your application, just make the folder without the extension first. You can rename it later when you're finished putting it all together. Inside this main folder will be a Contents folder, which will hold everything your application needs. Finally, inside Contents, you will place a few things:
Info.plist
MacOS
Resources
Frameworks
Here you can find some information on how to write your Info.plist file. Basically, this is where you detail information about your application.
Inside the MacOS you want to place your main executable. I'm not sure that it matters how you write it; at first, I just had a shell script that called python3 ./../Resources/MyApp.py. I didn't think this was very neat though, so eventually I called the GUI from a Python script which became my executable (I used Tkinter to build my application's GUI, and I wrote several modules which I will get to later). So now, my executable was a Python script with a shebang pointing to the Python framework in my application's Frameworks folder, and this script just created an instance of my custom Tk() subclass and ran the mainloop. Both methods worked, though, so unless someone points out a reason to choose one method over the other, feel free to pick. The one thing that I believe is necessary, is that you name your executable the SAME as your application (before adding the .app). That, I believe, is the only way that MacOS knows to use that file as your application's executable. Here is a source that describes the bundle structure in more detail; it's not a necessary read unless you really want to get into it.
In order to make your executable run smoothly, you want to make sure you know where your Python installation is. If you're like me, the first thing you tried doing on your new Mac was open up Terminal and type in python3. If this is the case, this prompted you to install the Xcode Command Line tools, which include an installation of Python 3.8.2 (most recent on Xcode 12). Then, this Python installation would be located at /usr/bin/python3, although it's actually using the Python framework located at
/Applications/Xcode.app/Developer/Library/Frameworks/Python3.framework/Versions/3.8/bin/python3
I believe, but am NOT CERTAIN, that you could simply make a copy of this framework and add it to your Frameworks folder in order to make the app portable. Make a copy of the Python3.framework folder, and add it to your app's Frameworks folder. A quick side note to be wary of; Xcode comes packaged with a lot of useful tools. In my current progress, the tool I am most hurting for is the Fortran compiler (that I believe comes as a part of GCC), which comes with Xcode. I need this to build SciPy with pip install scipy. I'm sure this is not the only package that would require tools that Xcode provides, but SciPy is a pretty popular package and I am currently facing this limitation. I think by copying the Python framework you still lose some of the symlinks that point to Xcode tools, so any additional input on this would be great.
In any case, locate the Python framework that you use to develop your programs, and copy it into the Frameworks folder.
Finally, the Resources folder. Here, place any modules that you wrote for your Python app. You also want to put your application's icon file here. Just make sure you indicate the name of the icon file, with extension, in the Info.plist file. Also, make sure that your executable knows how to access any modules you place in here. You can achieve this with
import os
os.chdir('./../Resources')
import MyModules
Finally, make sure that any dependencies your application requires are located in the Python framework site-packages. These will be located in Frameworks/Python3.framework/Versions/3.X.Y/lib/python3.x.y/site-packages/. If you call this specific installation of Python from the command line, you can use path/to/application/python3 -m pip install package and it should place the packages in the correct folder.
P.S. As far as building the installer for this application, there are a few more steps needed before your application is readily downloaded. For instance, I believe you need to use the codesign tool in order to approve your application for MacOS Gatekeeper. This requires having a developer license and manipulating certificates, which I'm not familiar with. You can still distribute the app, but anyone who downloads it will have to bypass the security features manually and it will seem a bit sketchy. If you're ready to build the installer (.pkg) file, take a look at the docs for productbuild; I used it and it works, but I don't yet know how to create custom steps and descriptions in the installer.
Additional resources:
A somewhat more detailed guide to the anatomy of a macOS app
A guide I found, but didn't use, on using codesign to get your app past Gatekeeper
A RealPython tutorial I found on using PyInstaller to build Python-based applications for all platforms

Flask mega tutorial part 5 error

Im going through the Microblog tutorial for Flask designed by Miguel.
I made it to part 4 without any issues. Everything ran in the end of part 4.
I started having issues in part 5. After a couple of tries and trying to troubleshoot with the comments in the page, I was not able to finish the exercise.
Thinking it was me, I deleted all of my project and replaced them with the zip downloadable in the page for the exercise. I still get the same error, so the problem is not the code itself.
I get the following error when running views.py:
Link to image on imgur (couldn't post it here due to not having enough reputation)
Here are the libraries I have installed:
Link to image on imgur (couldn't post it here due to not having enough reputation)
My setup:
I am using Pycharm to run the files. This machine runs Windows and I found that Pycharm is the most efficient way to run things without dealing with issues with the cmd line.
Python 3.4
virtualenv created by Pycharm
the code can be found on github: github.com/pdgonzalez872/microblog
Potential cause of the problem:
The problem may be with the path that I have set up (but why did it work until part 4?)
The code itself (maybe something was updated in flask/other libraries since the post?)
views.py isn't meant to be launched separately, there is run.py file to start the project.
Also, it uses relative imports (those with dots before module names), which don't work when you use them in a script passed to the interpreter and used as main. Sorry, I can't explain it well, but maybe you will be interested in those links:
https://docs.python.org/2/tutorial/modules.html#intra-package-references
How to do relative imports in Python?

Appengine SDK 1.7.3 not detecting updated files

I just updated to SDK 1.7.3 running on Linux. At the same time I switched to the SQLite datastore stub, suggested by the depreciation message.
After this, edits to source files are not always detected, and I have to stop and restart the SDK after updating, probably one time in ten. Is anyone else seeing this? Any ideas on how to prevent it?
UPDATE: Changes to python source files are not being detected. I haven't made any modifications to yaml files, and I believe that jinja2 template file modifications are being detected properly.
UPDATE: I added some logging to the dev appserver and found that the file I'm editing is not being monitored. Continuing to trace what is happening.
A similiar issue happens with appcfg.py in SDK 1.73, where it skips uploading some files sometimes. It looks like this only happens if appcfg.py is run under python 2.7.
The workaround is to simply run appcfg.py under python 2.5. Then the upload works reliably.
The code uploaded can still be 2.7 specific - it is only necessary to revert 2.5 in the step of running the uploader function in appcfg.py.
I've seen this after the 1.7.3 update too, on Mac. I didn't change anything with the datastore. I'd say one in ten is about right.
edit:
There's a solution here that involves adding "self._dirty = True" to google/appengine/tools/dev_appserver.py
http://code.google.com/p/googleappengine/issues/detail?id=8383
Seems to work for some, haven't seen the problem since.

Python3/MacOSX integration into pycharm

I have had trouble setting up the pycharm ide on my macosx10.7 with python3..
I have scoured every resource available and tried hundreds of approaches, at this point I must accept my incompetence and seek help via this channel.
In my research, I notice a lack of ground-up explanations on python integration into macosx and how to configure pycharm to import modules, run code within the editor, etc. If i ever solve this I will make a very detailed tutorial.
I have imported python3 successfully, it looks like it is linked appropriately from /sys/lib/frameworks to /usr/lib ...etc -- version control is working just fine.
I think my issue is either in setting environmental variables (tried the program to fix this and tried macports) and in the script needed to execute. it will catch errors throughout but final product does not run in python and returns printout of :
/Library/Frameworks/Python.framework/Versions/3.2/bin/python3.2 /Users/anon/Desktop/pythonpractice/Py_Ex/classes.py
Process finished with exit code 0
i really need to get this configuration sound for my python programming class. please help (I've been through every line of pycharm website) .. preferably is there a way to map it via terminal? thanks for anyone who took the time to read this.
Summary of the discussion above:
Python 3.2.2 installation was broken on this Mac, installing ActiveState Python 3.2.2 from scratch and configuring it in PyCharm has fixed the problem.
Python path to be used in PyCharm settings: /Library/Frameworks/Python.framework/Versions/3.2/bin/python3
Incompatible third-party plug-ins may break PyCharm, uninstall/disable them in Preferences | Plugins.
Ensure the latest PyCharm version is installed.
User's code depends on the graphics.py module which was not in the project or in the PYTHONPATH. Putting it into the project has solved the problem.
Most likely the wrong Run/Debug configuration was used in PyCharm, the easiest way to run or debug such scripts is by using the editor context menu Run and Debug actions. PyCharm creates the configuration automatically and debugging works fine as shown of the screenshot:
If one wants to configure and debug it, he can use the code.zip file to get started.
Sorry for the comments mess above, but it was not possible to move it into chat as user had only 1 reputation point, hence not able to use the chat feature of StackOverflow.

Python Plugins for QGIS

I am working with python plugins for QGIS . I am done with my one of my .py file using python 2.5 and pyqt4. It is just help file for QGIS, which I changed. I wanted to in-cooperate the same in QGIS. I installed QGIS 1.7.1.
I know it to be done through python plugins. But how to go about it?
where to copy my file, so that it will get open from QGIS?
QGIS already has that page(help file), I need to change it.
help me out.
If you're creating a QGIS plugin in Python, you may want to place it in your .qgis/python/plugins folder. Actually, you should create a subfolder below that. But that's not all, your code has to provide certain functions in order to get hooked up properly into QGIS. http://qgis.org/pyqgis-cookbook/plugins.html#plugins provides detailed information about that. Once your Python plugin is complete and located in the correct location, you'll have to enable it in the QGIS Plugin Manager (choose Plugins/Manage Plugins... from the manu). I'm not sure if your question is about creating QGIS Python Plugins or about replacing QGIS menu items via Python - could you clarify this? Are there any error messages for the things that are not working? Could you post your code (or relevant parts of it) for review (this might speed up the process of finding a solution)?

Categories