Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
giandex opened this issue May 30, 2023 · 7 comments
Closed

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

giandex opened this issue May 30, 2023 · 7 comments

Comments

@giandex
Copy link
Contributor

giandex commented May 30, 2023

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
Copy link
Owner

TeaM-TL commented May 31, 2023

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
Copy link
Contributor Author

giandex commented May 31, 2023

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
Copy link
Owner

TeaM-TL commented May 31, 2023

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

Can you share your SlackBuild?

@giandex
Copy link
Contributor Author

giandex commented Jun 1, 2023

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
Copy link
Contributor Author

giandex commented Jun 1, 2023

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
Copy link
Owner

TeaM-TL commented Jun 1, 2023

Thanks a lot!

Remember that hidden requirement is tkinter

@TeaM-TL
Copy link
Owner

TeaM-TL commented Jun 4, 2023

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

@TeaM-TL TeaM-TL closed this as completed Jun 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants