# Python Shell Gramplet + Multi line statements

**URL:** <https://gramps.discourse.group/t/python-shell-gramplet-multi-line-statements/4235>\
**Category:** Development\
**Created:** [September 29, 2023, 7:22am UTC](https://gramps.discourse.group/t/python-shell-gramplet-multi-line-statements/4235 "2023-09-29T07:22:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![SteveY](https://avatars.discourse-cdn.com/v4/letter/s/85e7bf/32.png) [@SteveY](https://gramps.discourse.group/u/SteveY)\
**Post date:** [September 29, 2023, 7:22am UTC](https://gramps.discourse.group/t/python-shell-gramplet-multi-line-statements/4235/1 "2023-09-29T07:22:12Z")

</div>

Is there any way to copy and paste a multi-line block of python into the Python Shell gramplet?  
I can get it to work if I paste each line in to the gramplet one by one but that gets tedious.  
I was hoping to write my code in a text editor and copy and paste in one go into the gramplet.

In case there’s any easier way to solve my problem, I want to replace an existing event attribute with two new attributes. The new attribute values will be extracted from the current attribute value.

---

<div class="post-metadata">

**Author:** ![Nick-Hall](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/nick-hall/32/95_2.png) [@Nick-Hall](https://gramps.discourse.group/u/Nick-Hall)\
**Post date:** [September 29, 2023, 12:46pm UTC](https://gramps.discourse.group/t/python-shell-gramplet-multi-line-statements/4235/2 "2023-09-29T12:46:17Z")

</div>

I usually use the Python Evaluation gramplet in a detached window.

---

<div class="post-metadata">

**Author:** ![SteveY](https://avatars.discourse-cdn.com/v4/letter/s/85e7bf/32.png) [@SteveY](https://gramps.discourse.group/u/SteveY)\
**Post date:** [September 29, 2023, 9:19pm UTC](https://gramps.discourse.group/t/python-shell-gramplet-multi-line-statements/4235/3 "2023-09-29T21:19:39Z")

</div>

For some reason the Python Evaluation gramplet is not offered in the Windows AIO 5.1.5 version.  
I do see it in a 5.2 AIO build I have and can install it on the dashboard in 5.2

The code exists in my 5.1 install: gramps\plugins\gramplet\eval.py. Apart from some whitespace, it is identical to the 5.2 version, so it’s not obvious why it is not offered?

It looks exactly what I need - but I’m not ready to move my main tree to 5.2 just yet 😉

---

<div class="post-metadata">

**Author:** ![Nick-Hall](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/nick-hall/32/95_2.png) [@Nick-Hall](https://gramps.discourse.group/u/Nick-Hall)\
**Post date:** [September 29, 2023, 10:28pm UTC](https://gramps.discourse.group/t/python-shell-gramplet-multi-line-statements/4235/4 "2023-09-29T22:28:32Z")

</div>

In the file `gramps/plugins/gramplet/gramplet.gpr.py` you will see where the Python Evaluation gramplet is registered. Change the line that reads “status=UNSTABLE” to “status=STABLE”. This will make the gramplet available to all users.

Alternatively, run Gramps without the `-O` option. This is a developer mode which makes unstable plugins available to use.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/gramps/original/1X/2ac1e712b7adf612e31ca08a55419f4cf37c0158.png) [@system](https://gramps.discourse.group/u/system)\
**Post date:** [October 29, 2023, 10:28pm UTC](https://gramps.discourse.group/t/python-shell-gramplet-multi-line-statements/4235/5 "2023-10-29T22:28:38Z")

</div>

Closed on October 29, 2023, 10:28pm UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
