Sat Aug 26, 2023 12:37 pm
def pluginGestartet():
if (shelf.has_key(pluginName) and shelf[pluginName]):
return True
return False
def pluginGestartet():
if (pluginName in shelf and shelf[pluginName]):
return True
return False
I do not understand why! The object "pluginName" is of type "str".Traceback (most recent call last):
File "C:\Program Files\GIMP 2\lib\gimp\2.0\python/gimpplugin.py", line 76, in _run
return apply(getattr(self, name), params)
File "C:\Users\Herbert\AppData\Roaming\GIMP\2.10\plug-ins\HN-Pfeil-zeichnen\HN-Pfeil-zeichnen.py", line 3488, in HN_Pfeil_zeichnen
if pluginGestartet():
File "C:\Users\Herbert\AppData\Roaming\GIMP\2.10\plug-ins\HN-Pfeil-zeichnen\HN-Pfeil-zeichnen.py", line 3186, in pluginGestartet
if (pluginName in shelf and shelf[pluginName]):
File "C:\Program Files\GIMP 2\lib\gimp\2.0\python/gimpshelf.py", line 75, in __getitem__
s = gimp.get_data(key)
TypeError: get_data() argument 1 must be string, not int
Sat Aug 26, 2023 2:19 pm
Sat Aug 26, 2023 4:39 pm
Herbie wrote:I want to convert my plugin from Python 2 to Python 3 using "Python 2 to 3 converter (https://python2to3.com/)".
The converter wants to convert the following Python 2 codeto the following Python 3 code
- Code:
def pluginGestartet():
if (shelf.has_key(pluginName) and shelf[pluginName]):
return True
return FalseWhen I swap out the code in my plugin, GIMP reports the following error:
- Code:
def pluginGestartet():
if (pluginName in shelf and shelf[pluginName]):
return True
return FalseI do not understand why! The object "pluginName" is of type "str".Traceback (most recent call last):
File "C:\Program Files\GIMP 2\lib\gimp\2.0\python/gimpplugin.py", line 76, in _run
return apply(getattr(self, name), params)
File "C:\Users\Herbert\AppData\Roaming\GIMP\2.10\plug-ins\HN-Pfeil-zeichnen\HN-Pfeil-zeichnen.py", line 3488, in HN_Pfeil_zeichnen
if pluginGestartet():
File "C:\Users\Herbert\AppData\Roaming\GIMP\2.10\plug-ins\HN-Pfeil-zeichnen\HN-Pfeil-zeichnen.py", line 3186, in pluginGestartet
if (pluginName in shelf and shelf[pluginName]):
File "C:\Program Files\GIMP 2\lib\gimp\2.0\python/gimpshelf.py", line 75, in __getitem__
s = gimp.get_data(key)
TypeError: get_data() argument 1 must be string, not int
Can someone help me?
def pluginGestartet():
return pluginName in shelf and shelf[pluginName]
def pluginGestartet():
# second "not" makes a True of empty string or None, and a False of an existing string
# first "not" invert this
return not not shelf.get(pluginName)
Tue Aug 29, 2023 9:40 am
vitforlinux wrote:You may be the hero who initiates the change, but the road is full of obstacles, you have to overcome mountains, slay dragons, and keep away from the thumping trees... and hope there is nothing else new in Gimp 2.99.18.
Be brave.
Tue Apr 23, 2024 11:21 am
def pluginGestartet():
if (shelf.has_key(pluginName) and shelf[pluginName]):
return True
return False
def pluginGestartet():
return shelf.has_key(pluginName) and shelf[pluginName]