# Python shell reset on first use with Paraview 5.6

**URL:** https://discourse.paraview.org/t/python-shell-reset-on-first-use-with-paraview-5-6/2978
**Category:** ParaView Support
**Tags:** python
**Created:** [November 14, 2019, 3:45pm UTC](https://discourse.paraview.org/t/python-shell-reset-on-first-use-with-paraview-5-6/2978 "2019-11-14T15:45:58Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![aspsgge](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/a/a87d85/32.png) [@aspsgge](https://discourse.paraview.org/u/aspsgge)
#### Post date: [November 14, 2019, 3:45pm UTC](https://discourse.paraview.org/t/python-shell-reset-on-first-use-with-paraview-5-6/2978/1 "2019-11-14T15:45:58Z")

</div>

Hello,

I’ve got an issue with Paraview 5.6.0 with the use of script.

I open the GUI of ParaView with command line and the use of --script=name\_of\_script.py to execute a python script at the openning

 ![image](https://discourse.paraview.org/uploads/default/original/2X/5/59b94531c2a1f02b54578e6d4ef91659acea1db2.png)

This open me the GUI of Paraview and execute some operations like loading geometry and perform some post processing. And also load some home made python libraries with post-processing functions like plot line at location of interest if wanted by the user.

With ParaView 5.4, after the script finished, I can write command inside Python shell to execute these post processing functions. With ParaView 5.6, when I click on Python shell, I’ve got a kind of reset of script and the post-processing functions are thus not available. I need to launch again the script by using Run Script button inside Python shell, which is not expected (the use of --script in command line is supposed to replace the Run Script button)

Data loaded after python script run from command line

 ![image](https://discourse.paraview.org/uploads/default/original/2X/5/58f398c3760f251b8576ae38ba61fe2458514943.jpeg)

When I click inside Python shell to run a command :  
 ![image](https://discourse.paraview.org/uploads/default/original/2X/2/2dc3039afed9422e672b3627bbbd977e64e4bb41.png)

There is a kind of reset after the first line and then write “from paraview.simple import \*”.

I switched from Paraview 5.4 to ParaView 5.6 because I can’t find the PointArrayStatus property of a source to load only the wanted data.

source = FindSource(‘resu.vtm’)  
source.PointArrayStatus = [‘Data1’,‘Data2’]

Is there a way to not having this python shell reset when we click on the python shell for the first time?

I hope my explanation is enough good. I will try to give a simple python script exemple soon.

Thank you.

---

<div class="post-metadata">

### Author: ![utkarsh.ayachit](https://discourse.paraview.org/user_avatar/discourse.paraview.org/utkarsh.ayachit/32/39_2.png) [@utkarsh.ayachit](https://discourse.paraview.org/u/utkarsh.ayachit)
#### Post date: [November 14, 2019, 3:49pm UTC](https://discourse.paraview.org/t/python-shell-reset-on-first-use-with-paraview-5-6/2978/2 "2019-11-14T15:49:16Z")

</div>

It’s not resetting, it’s setting up the interactive interpreter. Why do you not what it do that? What is the issue you’re having because of it?

---

<div class="post-metadata">

### Author: ![cory.quammen](https://discourse.paraview.org/user_avatar/discourse.paraview.org/cory.quammen/32/11193_2.png) [@cory.quammen](https://discourse.paraview.org/u/cory.quammen)
#### Post date: [November 14, 2019, 3:54pm UTC](https://discourse.paraview.org/t/python-shell-reset-on-first-use-with-paraview-5-6/2978/3 "2019-11-14T15:54:15Z")

</div>

Welcome to ParaView, @aspsgge. It looks to me like you can’t set the active point arrays because none of the arrays have names in the GUI. I believe that is the root cause of your problem.

---

<div class="post-metadata">

### Author: ![aspsgge](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/a/a87d85/32.png) [@aspsgge](https://discourse.paraview.org/u/aspsgge)
#### Post date: [November 14, 2019, 4:00pm UTC](https://discourse.paraview.org/t/python-shell-reset-on-first-use-with-paraview-5-6/2978/4 "2019-11-14T16:00:44Z")

</div>

Thank you for your quick answers. (the array names were hidden, that’s why there is no array name). I will explain better my issue.

Here is an example of script :

```
#### BEGIN ######

from paraview.simple import *
#### disable automatic camera reset on 'Show'
paraview.simple._DisableFirstRenderCameraReset()

# create a new 'Sphere'
sphere1 = Sphere()
sphere1.ThetaResolution = 20
sphere1.PhiResolution = 20

# get active view
renderView1 = GetActiveViewOrCreate('RenderView')
# uncomment following to set a specific view size
# renderView1.ViewSize = [1618, 480]

# show data in view
sphere1Display = Show(sphere1, renderView1)

import numpy as np
a = np.linspace(0,1,10)

##### END #####

```

This script is save as test\_script.py

If I run ParaView with this way :

/Home/ParaView5.6/bin/paraview --mesa-llvm -script=/Home/test\_script.py

This opens me Paraview and execute the script :

 ![image](https://discourse.paraview.org/uploads/default/original/2X/c/c191f24eaee7b5164953cd0694423545d4c09568.png)

But if I want to use a function of numpy inside the python shell, it’s not possible even if numpy was loaded inside the python script.  
 ![image](https://discourse.paraview.org/uploads/default/original/2X/d/d24101ce24d2c3294b4e9bafba5dd261ab33ffd2.png)

This was possible with Paraview 5.4

 ![image](https://discourse.paraview.org/uploads/default/original/2X/e/e5916c70e8454d15ce1ed0a397e01736eae3ca49.png)

---

<div class="post-metadata">

### Author: ![utkarsh.ayachit](https://discourse.paraview.org/user_avatar/discourse.paraview.org/utkarsh.ayachit/32/39_2.png) [@utkarsh.ayachit](https://discourse.paraview.org/u/utkarsh.ayachit)
#### Post date: [November 14, 2019, 4:08pm UTC](https://discourse.paraview.org/t/python-shell-reset-on-first-use-with-paraview-5-6/2978/5 "2019-11-14T16:08:51Z")

</div>

The Python shell is now executing in a separate context, so you’ll just need to import stuff again. Just do `import numpy as np` again in the shell and it’d be fine.

---

<div class="post-metadata">

### Author: ![aspsgge](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/a/a87d85/32.png) [@aspsgge](https://discourse.paraview.org/u/aspsgge)
#### Post date: [November 14, 2019, 4:16pm UTC](https://discourse.paraview.org/t/python-shell-reset-on-first-use-with-paraview-5-6/2978/6 "2019-11-14T16:16:46Z")

</div>

Thank you for your quick help

So there is no real solution except running the script again. :-/  
For my use, it’s not just one line like import numpy as np, but a lot of lines… This was for a simple example.

I see that in Paraview 5.7, there is no more option “–script=” for executing paraview. This features of launching a python script at the opening is now not supported?
