Bug 392227 - 4.0.0.100 Does not load: Throws a python error
Summary: 4.0.0.100 Does not load: Throws a python error
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Scripting (show other bugs)
Version: 4.0
Platform: Microsoft Windows Microsoft Windows
: NOR crash
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords: triaged
: 392406 (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-03-23 11:00 UTC by dncnmckn
Modified: 2019-04-05 13:36 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Backtrace from Krita startup crash (331.45 KB, text/plain)
2018-03-29 13:20 UTC, Markus
Details
Sceenshot of error (323.41 KB, image/jpeg)
2018-03-29 21:28 UTC, claudiomet
Details
Backtrace of Krita crashing while opening documents and when deleting palettes (674.00 KB, text/plain)
2018-04-04 14:21 UTC, Markus
Details

Note You need to log in before you can comment on or make changes to this bug.
Description dncnmckn 2018-03-23 11:00:30 UTC
Hi.

Loading Krita gives the following error:

IndexError
Python 3.6.2: python
Fri Mar 23 10:48:58 2018

A problem occurred in a Python script.  Here is the sequence of
function calls leading up to the error, in the order they occurred.

 C:\Program Files\Krita (x64)\lib\krita-python-libs\krita\dockwidgetfactory.py in createDockWidget(self=<krita.dockwidgetfactory.DockWidgetFactory object>)
   10         super().__init__(_id, _dockPosition)
   11         self.klass = _klass
   12 
   13     def createDockWidget(self):
   14         return self.klass()
self = <krita.dockwidgetfactory.DockWidgetFactory object>
self.klass = <class 'palette_docker.palette_docker.Palette_Docker'>

 C:\Program Files\Krita (x64)\share\krita\pykrita\palette_docker\palette_docker.py in __init__(self=<palette_docker.palette_docker.Palette_Docker object>)
   48             self.cmb_palettes.model().sort(0)
   49 
   50         self.currentPalette = Palette(allPalettes[list(allPalettes.keys())[0]])
   51         self.cmb_palettes.currentTextChanged.connect(self.slot_paletteChanged)
   52         layout.addWidget(self.cmb_palettes)  # add combobox to the layout
self = <palette_docker.palette_docker.Palette_Docker object>
self.currentPalette undefined
global Palette = <class 'PyKrita.krita.Palette'>
allPalettes = {}
builtinlist = <class 'list'>
allPalettes.keys = <built-in method keys of dict object>
IndexError: list index out of range
    __cause__ = None
    __class__ = <class 'IndexError'>
    __context__ = None
    __delattr__ = <method-wrapper '__delattr__' of IndexError object>
    __dict__ = {}
    __dir__ = <built-in method __dir__ of IndexError object>
    __doc__ = 'Sequence index out of range.'
    __eq__ = <method-wrapper '__eq__' of IndexError object>
    __format__ = <built-in method __format__ of IndexError object>
    __ge__ = <method-wrapper '__ge__' of IndexError object>
    __getattribute__ = <method-wrapper '__getattribute__' of IndexError object>
    __gt__ = <method-wrapper '__gt__' of IndexError object>
    __hash__ = <method-wrapper '__hash__' of IndexError object>
    __init__ = <method-wrapper '__init__' of IndexError object>
    __init_subclass__ = <built-in method __init_subclass__ of type object>
    __le__ = <method-wrapper '__le__' of IndexError object>
    __lt__ = <method-wrapper '__lt__' of IndexError object>
    __ne__ = <method-wrapper '__ne__' of IndexError object>
    __new__ = <built-in method __new__ of type object>
    __reduce__ = <built-in method __reduce__ of IndexError object>
    __reduce_ex__ = <built-in method __reduce_ex__ of IndexError object>
    __repr__ = <method-wrapper '__repr__' of IndexError object>
    __setattr__ = <method-wrapper '__setattr__' of IndexError object>
    __setstate__ = <built-in method __setstate__ of IndexError object>
    __sizeof__ = <built-in method __sizeof__ of IndexError object>
    __str__ = <method-wrapper '__str__' of IndexError object>
    __subclasshook__ = <built-in method __subclasshook__ of type object>
    __suppress_context__ = False
    __traceback__ = <traceback object>
    args = ('list index out of range',)
    with_traceback = <built-in method with_traceback of IndexError object>

The above is a description of an error in a Python program.  Here is
the original traceback:

Traceback (most recent call last):
  File "C:\Program Files\Krita (x64)\lib\krita-python-libs\krita\dockwidgetfactory.py", line 14, in createDockWidget
    return self.klass()
  File "C:\Program Files\Krita (x64)\share\krita\pykrita\palette_docker\palette_docker.py", line 50, in __init__
    self.currentPalette = Palette(allPalettes[list(allPalettes.keys())[0]])
IndexError: list index out of range

If I close the pop up window that contains that, it says 'krita.exe' has stopped working.

Please let me know if there's anything else you need. Thanks.

-------

OS: Windows 10 Home 64
Version: 1709
Build: 16299.309

Dell XPS 8700
i7-4770 CPU @ 3.4 GHz
12 GB RAM
NVIDIA GeForce GTX 645
Comment 1 Alvin Wong 2018-03-23 14:00:27 UTC
Do you somehow have none of the default palettes installed or have got them all blacklisted? I can reproduce this crash by manually causing Krita to not able to find any palettes.
Comment 2 dncnmckn 2018-03-23 17:47:50 UTC
This is straight from download, installation and trying to start the file. I don't get as far being able to install palletes.
Comment 3 Halla Rempt 2018-03-27 12:15:20 UTC
*** Bug 392406 has been marked as a duplicate of this bug. ***
Comment 4 Halla Rempt 2018-03-27 12:18:00 UTC
I'm beginning to suspect that for some people the palette docker gets loaded before the resources are loaded. Maybe because they have a slower disk?
Comment 5 Markus 2018-03-27 12:28:31 UTC
(In reply to Alvin Wong from comment #1)
> Do you somehow have none of the default palettes installed or have got them
> all blacklisted? I can reproduce this crash by manually causing Krita to not
> able to find any palettes.

It must be something like this. I now re-installed version 4.0 Beta - it starts but doesn't find any palettes. Where are the standard palettes lokated and how do I fix this?
Comment 6 Markus 2018-03-27 12:29:42 UTC
(In reply to Boudewijn Rempt from comment #4)
> I'm beginning to suspect that for some people the palette docker gets loaded
> before the resources are loaded. Maybe because they have a slower disk?

My system runs on an SSD so speed is probably not an issue?
Comment 7 Markus 2018-03-27 12:34:19 UTC
(In reply to Alvin Wong from comment #1)
> Do you somehow have none of the default palettes installed or have got them
> all blacklisted? I can reproduce this crash by manually causing Krita to not
> able to find any palettes.

What do you mean by "blacklisted?" how could I fix this?
Comment 8 dncnmckn 2018-03-27 12:50:30 UTC
Mine does not run on an SSD.
Comment 9 Markus 2018-03-27 13:07:32 UTC
(In reply to Alvin Wong from comment #1)
> Do you somehow have none of the default palettes installed or have got them
> all blacklisted? I can reproduce this crash by manually causing Krita to not
> able to find any palettes.

I cannot even import any new palette bundle! If I choose the bundle file it afterwords does not appear in the dialog - so nothing happens.
Comment 10 Markus 2018-03-27 13:08:46 UTC
(In reply to Alvin Wong from comment #1)
> Do you somehow have none of the default palettes installed or have got them
> all blacklisted? I can reproduce this crash by manually causing Krita to not
> able to find any palettes.

How do you cause this exactly, step by step?
Comment 11 Halla Rempt 2018-03-27 13:16:52 UTC
Git commit c7d6d313e4dd72590bc2803e08c6f0b6371d3b99 by Boudewijn Rempt.
Committed on 27/03/2018 at 13:16.
Pushed by rempt into branch 'master'.

Check whether there are any palettes in the python palette docker init

It's entirely possible that there are none, for instance if the user
has blacklisted them all.

M  +15   -3    plugins/python/palette_docker/palette_docker.py

https://commits.kde.org/krita/c7d6d313e4dd72590bc2803e08c6f0b6371d3b99
Comment 12 Markus 2018-03-27 13:24:06 UTC
(In reply to Boudewijn Rempt from comment #11)
> Git commit c7d6d313e4dd72590bc2803e08c6f0b6371d3b99 by Boudewijn Rempt.
> Committed on 27/03/2018 at 13:16.
> Pushed by rempt into branch 'master'.
> 
> Check whether there are any palettes in the python palette docker init
> 
> It's entirely possible that there are none, for instance if the user
> has blacklisted them all.
> 
> M  +15   -3    plugins/python/palette_docker/palette_docker.py
> 
> https://commits.kde.org/krita/c7d6d313e4dd72590bc2803e08c6f0b6371d3b99

Thank you Boudewijn. Since I am just a normal Krita user I am completely lost and confused with this issue - what does all this mean for me? I have no idea what "blacklisted" means, how this could have happended and how to resolve it. Now, in addition, my pen tablet refuses to work properly together with krita. Everything was stable before...
Comment 13 Markus 2018-03-27 18:08:38 UTC
Additional detail: clicking on the folder icon in the palette docker makes Krita crash. If you mean read/write protection by blacklisting (?): the Palette.kpl-File (and the other palettes) in \AppData\Roaming\krita\palettes is fully accessible. Is this the standard palette file? As said, I got the docker but no palettes in it.
Comment 14 Markus 2018-03-28 15:06:05 UTC
(In reply to Boudewijn Rempt from comment #11)
> Git commit c7d6d313e4dd72590bc2803e08c6f0b6371d3b99 by Boudewijn Rempt.
> Committed on 27/03/2018 at 13:16.
> Pushed by rempt into branch 'master'.
> 
> Check whether there are any palettes in the python palette docker init
> 
> It's entirely possible that there are none, for instance if the user
> has blacklisted them all.
> 
> M  +15   -3    plugins/python/palette_docker/palette_docker.py
> 
> https://commits.kde.org/krita/c7d6d313e4dd72590bc2803e08c6f0b6371d3b99

Thank you very much Boudewijn for trying to fix this so fast in the new nightly build - I appreciate. But unfortunately it doesnt help - what differs now is that Krita crashes when loading main window on startup WITHOUT a python error message. Thus I reopened this Bug report allthough not knowing if this crashing has the same reason. Sorry if this is messing around. Have a good evening.
Comment 15 Halla Rempt 2018-03-28 15:21:19 UTC
Um, I've been starting Krita all day and had no crashes. Could you provide a backtrace?
Comment 16 Markus 2018-03-28 15:43:44 UTC
(In reply to Boudewijn Rempt from comment #15)
> Um, I've been starting Krita all day and had no crashes. Could you provide a
> backtrace?

What do you mean by backtrace exactly? Sorry if this is a dumb question. I had 3.3.3 installed - everything fine. Then 4.0 Beta (krita-x64-4.0.0.51-setup.exe downloaded 13.3.18). This worked fine for a while. After a while, several startups later the pallets disapeared. Then I tried 4.0 official release where the python error happened which I reported. Now the nightly build with this crash. I'm now back to 4.0 Beta and have to work without palettes but I still can work. If I try to make a new palette in 4.0 Beta it creates a kpl file in the user.../palettes/ folder but I can't see it in the docker. Are there any log files I could provide you and if yes where would I find them?
Comment 17 Alvin Wong 2018-03-29 13:05:36 UTC
Please find the backtrace using the instructions here: https://docs.krita.org/Dr._Mingw_debugger
Comment 18 Markus 2018-03-29 13:20:36 UTC
Created attachment 111722 [details]
Backtrace from  Krita startup crash

the logs from 28 March are the relevant ones
Comment 19 claudiomet 2018-03-29 21:28:12 UTC
Created attachment 111728 [details]
Sceenshot of error

Same to me, clean instal of Krita 4.0.0 on Windows 10 64 bits (in spanish, Chile)
Comment 20 Halla Rempt 2018-04-03 10:11:08 UTC
Should be fixed now.
Comment 21 Markus 2018-04-03 10:14:13 UTC
(In reply to Boudewijn Rempt from comment #20)
> Should be fixed now.

Many thanks Boudewijn! I will try another installation tomorrow with the newest nightly build and give you feedback afterwords. Have a good day.
Comment 22 Halla Rempt 2018-04-03 11:45:57 UTC
Git commit c7c121285337d70479d43ca3231a69bee0a36680 by Boudewijn Rempt.
Committed on 03/04/2018 at 11:16.
Pushed by rempt into branch 'krita/4.0'.

Check whether there are any palettes in the python palette docker init

It's entirely possible that there are none, for instance if the user
has blacklisted them all.
(cherry picked from commit c7d6d313e4dd72590bc2803e08c6f0b6371d3b99)

M  +15   -3    plugins/python/palette_docker/palette_docker.py

https://commits.kde.org/krita/c7c121285337d70479d43ca3231a69bee0a36680
Comment 23 Markus 2018-04-04 14:21:22 UTC
Created attachment 111822 [details]
Backtrace of Krita crashing while opening documents and when deleting palettes

Hi Boudewijn - I am really thankfull for your hard work on this problem. We are a big step further now since Krita starts up now and (allmost) everything works under certain conditions. But still there seems to be a problem in todays nightly build with the loading of the palettes at startup - see this behaviour:

a) Doubbleclicking the Krita desktop icon starts up krita correctly, main Window opens.

b) Krita is either running (via a)) or not running, then doubleclicking on a .kra document opens it correctly in Krita. Any further file can be started up, closed again and worked with correctly. Great! 

c) Opening Krita by doubbleclicking the shortcut icon on the desktop opens Krita - BUT - if I then do file->open->(any file type) Krita crashes without opening the file before (you never see the file).

d) Opening any file type, including .kra by rightclicking on it and -> open with... starts up Krita, opens main window correctly but then file does not open and krita crashes like in c)

e) When a document is started up in Krita correctly like in b), I then open the palette docker - there are only two palettes (default and web) which are populated with colors. All my earlier installed palettes (like pixel art 16 and pixel art 32) are empty. New palettes can be created. Any of the palettes (also the old empty ones) can be populated with new colors which persist there after closing and re-opening Krita. BUT - when trying to delete a palette with the trashbin-button, Krita crashes. Tags work perfectly.


now some minutes, after trying around more, very strange:

Starting up Krita.exe directly from program directory by doubleclicking it: krita opens without the old emty palettes but only with david revoys deevad-palettes (deevad and deevad-mini) which I installed a fiew minutes ago as a bundle.

But: starting up Krita by the desktop shortcut or by doubblclicking a .kra opens krita with all the above emty old palettes!

So it makes a difference on which palettes appear in which way I open krita - directly via krita.exe or via desktop shortcut!

Now, after opening / closing a fiew times I cannot reproduce the above crashes anymore except for the delete-palette-crash which remains.

I hope this helps to find the bug. After this is fully solved I will make a big donation!

See also the attached backtrace where the crashes are documented.

Cheers and thanks again, Markus from Zurich Switzerland
Comment 24 Markus 2018-04-05 20:24:29 UTC
Now I installed build 114. The strange palette behaviour remains:

1. Starting up krita with desktop shortcut or directly from krita.exe: 
no pallets appear in the palette docker except for those installed as bundles by the resource manager (like in my case deevad and deevad-mini). New palettes are saved in C:\Users\myname\AppData\Roaming\krita\palettes but do not reappear after restart.

2 When Krita starts up by doubbleclicking an existing document:
the palettes appear in the docker - also those previously saved new palettes (1.). The attempt to delete a palette still leads to crash as described in previous comment, see backtrace.
Comment 25 Halla Rempt 2018-04-06 07:59:02 UTC
That backtrace isn't related to the python code: it's something in the g'mic integration plugin...
Comment 26 Scott Petrovic 2019-04-05 13:36:34 UTC
I am going to close this for now as it is a year old and the bug being discussed was about python...which seems to have been fixed.

If there are still issues with this you can open up another ticket.