TeaM-TL / FotoKilof

GUI for ImageMagick and Wand
MIT License
287 stars 18 forks source link

AttributeError: module 'fotokilof' has no attribute '__main__' #157

Closed giandex closed 1 year ago

giandex commented 1 year ago

Hi TeaM-TL I'm trying to build a slackbuild (tool to create installation packages for Slackware) for FotoKilof. My purpose is to share it in Slackbuilds.org that is the main repository of packages for Slackware users not released in the official distribution. In Slackware we use ImageMagick tools from command line but I think that a nice GUI as FotoKilof could be appreciated by many users. FotoKilof can be installed with pip and in my system it seems working fine, but installations from pip are not recommended because they are beyond the control of the packages management tools in Slackware.

The slackbuild works, but it builds the script fotokilof.py instead of __main__.py: after the installation, launch of executable fotofilof return this error: Traceback (most recent call last): File "/usr/bin/fotokilof", line 33, in <module> sys.exit(load_entry_point('FotoKilof==4.3.2', 'gui_scripts', 'fotokilof')()) File "/usr/bin/fotokilof", line 25, in importlib_load_entry_point return next(matches).load() File "/usr/lib64/python3.9/importlib/metadata.py", line 88, in load return functools.reduce(getattr, attrs, module) AttributeError: module 'fotokilof' has no attribute '__main__'

I'm sure that this depends on the python configuration in Slackware (the latest Slackware releases have Python 3.9 and Pillow 8.4.0). The issue happens with the command python3 setup.py --install (launched in the root of the source)

This usually does not happen with the build of a lot of python packages from sources in the standard configuration of Slackware. I think I have to do something by passing an environment variable or patching the source to adapt the build to the context. Have you any idea to help me to solve it? I'm not a python developer, I'm only a package mantainer for Slackware. Thanks :-)

TeaM-TL commented 1 year ago

Hi Giancarlo I'm not the best in packaging. I think, that you can rename fotokilof.py to __main__.py and remove from setyp.py directive entry_points. I hope it can help.

My idea is move from setup.py to setup.cfg ( #156 ), to be more up-to-date

giandex commented 1 year ago

Ops, I didn't think to rename fotokilof.py before the build, it's a good idea! The directive entry_points must be removed otherwise the same problem happens. There is another little issue because the build does not create the executable launcher ( /usr/bin/fotofilof ) but I shoud be able to solve it, I have to do some tests tomorrow. When I finish I'll post a report

Thanks a lot, for now!

TeaM-TL commented 1 year ago

I renamed fotokilof.py into main.py, try it

Can you share your SlackBuild?

giandex commented 1 year ago

Sorry, Tomasz I read your last post just now, meanwhile I solved the problem with the original source by manually adding a python script to start the application. I copied this script from the package installed with pip and it is added "manually" with cat in the installation tree in /usr/bin within the slackbuild script. It works! I attach the slackbuild script. Usually these script are named with the extension "SlackBuild" (e.g. FotoKilof.SlackBuild)

I'll try also to build the package with your change: it's possible that it works without any other tricks. I had only to add a desktop entry compliant to KDE graphic environment and some post-install directives that usually are included in the installation package in /usr/install/doinst.sh

FotoKilof.txt

giandex commented 1 year ago

I've made another build applying your changes. It works, the result seems similar but I think it's better than the previous build because it includes also changes that you has done in some scripts.

Unfortunately the build does not create an executable launcher, but this is not a problem since I add a launcher script in the installation tree (like in previous version).

Thanks Tomasz, your support has been very precious! Can I reciprocate by contributing to the localization with the addition of the Italian translation? I'll work on it in the next days

TeaM-TL commented 1 year ago

Thanks a lot!

Remember that hidden requirement is tkinter

TeaM-TL commented 1 year ago

localization please to send by pull request. I thin this issue I can close