# Problems with launcher.py

**URL:** <https://discourse.paraview.org/t/problems-with-launcher-py/12440>\
**Category:** Web Support\
**Created:** [July 3, 2023, 2:22pm UTC](https://discourse.paraview.org/t/problems-with-launcher-py/12440 "2023-07-03T14:22:22Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![sebasgut1](https://discourse.paraview.org/user_avatar/discourse.paraview.org/sebasgut1/32/11526_2.png) [@sebasgut1](https://discourse.paraview.org/u/sebasgut1)\
**Post date:** [July 3, 2023, 2:22pm UTC](https://discourse.paraview.org/t/problems-with-launcher-py/12440/1 "2023-07-03T14:22:22Z")

</div>

Hello,  
I was trying to follow [this](https://kitware.github.io/paraviewweb/docs/multi_user_setup.html) setup guide for Multi-users in ParaViewWeb, but instead of using Apache I am using VTK.js in an Angular application. I am using ParaView 5.10.1 and the path to launcher.py is C:\Program Files\ParaView 5.10.1-Windows-Python3.9-msvc2017-AMD64\bin\Lib\site-packages\wslink, I was trying to configure it with this file:

```auto
{
  // ===============================
  // General launcher configuration
  // ===============================

  "configuration": {
    "host" : "localhost", // name of network interface to bind for launcher webserver
    "port" : 8080, // port to bind for launcher webserver
    "endpoint": "paraview", // SessionManager Endpoint
    "proxy_file" : "/.../proxy-mapping.txt", // Proxy-Mapping file for Apache
    "sessionURL" : "ws://${host}:${port}/ws", // ws url used by the client to connect to started process
    "timeout" : 5, // Wait time in second after process start
    "log_dir" : "./viz-logs", // Directory for log files
    "upload_dir" : "/.../uploadDirectory", // Start file upload server on same port as launcher
    "fields" : ["file", "host", "port", "updir"] // Fields not listed are filtered from response
  },

   // ===============================
   // Useful session vars for client
   // ===============================

  "sessionData" : { "key": "value" }, // Dictionary of values interesting to the client

  // ===============================
  // Resources list for applications
  // ===============================

  "resources" : [{ "host" : "localhost", "port_range" : [9001, 9003] } ],

  // ===============================
  // Set of properties for cmd line
  // ===============================

  "properties" : {
    "build_dir" : "/.../build",
    "python_exec" : "/.../build/bin/vtkpython",
    "WWW" : "/.../build/www",
    "source_dir": "/.../src",
    "vtkpython" : "/.../VTK/build/bin/vtkpython",
    "pvpython" : "/.../ParaView/build/bin/pvpython",
    "vtk_python_path": "/.../VTK/build/Wrapping/Python/vtk/web",
    "pv_python_path": "/.../ParaView/build/lib/site-packages/paraview/web",
    "plugins_path": "/.../ParaView/build/lib",
    "dataDir": "/.../path/to/data/directory"
  },

  // ===============================
  // Application list with cmd line
  // ===============================

  "apps": {
    "visualizer": {
        "cmd": [
            "${pvpython}", "-dr", "C:\\Users\\User\\Documents\\pvw_server.py",
            "--port", "${port}", "-f", "--authKey", "${secret}"
        ],
        "ready_line" : "Starting factory"
    }
  }
}

```

This is the config object in the Angular application:

```auto
const config = {
      application: 'visualizer',
      sessionManagerURL: 'http://localhost:8080/paraview',
      };

```

When I start the launcher with pvpython and the configuration, the server runs listening to port 8080, but when I am try to make a POST, I get a 404 error, in the log file I see that the endpoint is reached. Am I doing something wrong? Is there anything missing?  
Thanks.

---

<div class="post-metadata">

**Author:** ![jourdain](https://discourse.paraview.org/user_avatar/discourse.paraview.org/jourdain/32/11_2.png) [@jourdain](https://discourse.paraview.org/u/jourdain)\
**Post date:** [July 4, 2023, 5:25pm UTC](https://discourse.paraview.org/t/problems-with-launcher-py/12440/2 "2023-07-04T17:25:40Z")

</div>

I would cleanup your launcher config to remove everything you don’t use. And then I would clarify what you mean by log and post request endpoint.

```auto
{
  "configuration": {
    "host" : "localhost",                         
    "port" : 8080,                                  
    "endpoint": "paraview",                   
    "proxy_file" : "proxy-mapping.txt",  
    "sessionURL" : "ws://${host}:${port}/ws",    
    "timeout" : 25,
    "log_dir" : ".", 
    "fields" : []
  },

  "resources" : [{ "host" : "localhost", "port_range" : [9001, 9050] } ],

  "properties" : {
    "pvpython": "C:\\Program Files\\ParaView 5.10.1-Windows-Python3.9-msvc2017-AMD64\\bin\\pvpython.exe"
  },

  "apps": {
    "visualizer": {
        "cmd": [
            "${pvpython}", "-dr", "C:\\Users\\User\\Documents\\pvw_server.py",
            "--port", "${port}", "-f", "--authKey", "${secret}"
        ],
        "ready_line" : "Starting factory"
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![sebasgut1](https://discourse.paraview.org/user_avatar/discourse.paraview.org/sebasgut1/32/11526_2.png) [@sebasgut1](https://discourse.paraview.org/u/sebasgut1)\
**Post date:** [July 4, 2023, 5:46pm UTC](https://discourse.paraview.org/t/problems-with-launcher-py/12440/3 "2023-07-04T17:46:53Z")

</div>

I modified the launcher.config as you suggested. However, when I run the launcher that is listening to port 8080 I mocked the a HTTP POST to see if the server responded back with the configuration with the sessionURL as described [here](https://kitware.github.io/paraviewweb/docs/launcher_api.html), but I got this:

 ![image](https://discourse.paraview.org/uploads/default/original/2X/c/cbe2dd2f2be0db4b1fb24503c66b092a98580f54.png)  
I do not know if I have to modify something inside launcher.py. I hope this clarifies the situation.

---

<div class="post-metadata">

**Author:** ![jourdain](https://discourse.paraview.org/user_avatar/discourse.paraview.org/jourdain/32/11_2.png) [@jourdain](https://discourse.paraview.org/u/jourdain)\
**Post date:** [July 4, 2023, 11:05pm UTC](https://discourse.paraview.org/t/problems-with-launcher-py/12440/4 "2023-07-04T23:05:35Z")

</div>

Try running the launcher on another port. I have no idea, why you get a 404.  
Any log from the launcher? Does the launcher start or does it complain that something is already running on port 8080?

---

<div class="post-metadata">

**Author:** ![sebasgut1](https://discourse.paraview.org/user_avatar/discourse.paraview.org/sebasgut1/32/11526_2.png) [@sebasgut1](https://discourse.paraview.org/u/sebasgut1)\
**Post date:** [July 5, 2023, 6:53am UTC](https://discourse.paraview.org/t/problems-with-launcher-py/12440/5 "2023-07-05T06:53:57Z")

</div>

I solved it, the problem was the path should have a “/” at end, like this: `http://localhost:8080/paraview/`. Now the problem I am having is this one:

```auto
Access to XMLHttpRequest at 'http://localhost:8080/paraview/' from origin 'http://localhost:4200' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

```

I am using ng serve. If I make the HTTP request in postman, it works perfectly. Should I change something in launcher.config to not being blocked by CORS policy?

I am not using apache or ngnix, I do not want to build the app. Nontheless, is it necessary to use any of them to create a multi-user server?

---

<div class="post-metadata">

**Author:** ![jourdain](https://discourse.paraview.org/user_avatar/discourse.paraview.org/jourdain/32/11_2.png) [@jourdain](https://discourse.paraview.org/u/jourdain)\
**Post date:** [July 5, 2023, 8:03pm UTC](https://discourse.paraview.org/t/problems-with-launcher-py/12440/6 "2023-07-05T20:03:06Z")

</div>

Multi-user setup should not be needed for development. But you can create a proxy to your launcher in your ng dev server.

---

<div class="post-metadata">

**Author:** ![sebasgut1](https://discourse.paraview.org/user_avatar/discourse.paraview.org/sebasgut1/32/11526_2.png) [@sebasgut1](https://discourse.paraview.org/u/sebasgut1)\
**Post date:** [July 6, 2023, 9:33am UTC](https://discourse.paraview.org/t/problems-with-launcher-py/12440/7 "2023-07-06T09:33:14Z")

</div>

You are right, I tried to use nginx and make direct HTTP request and the fill the config structure for SmartConnect with the response.  
I have another problem regarding DELETE, it seems does not work properly, because when I make a DELETE with this url `http://localhost:8080/paraview/` I receive a message error from server like this:

```auto
{
	"error": "id not provided in DELETE request"
}

```

But when I provided the id like this `http://localhost:8080/paraview/63e544aa-1bde-11ee-95c4-28d0eacffb1a`, the server does not found the delete handler, it seems like it recognize this path as a whole new endpoint without handler.

---

<div class="post-metadata">

**Author:** ![jourdain](https://discourse.paraview.org/user_avatar/discourse.paraview.org/jourdain/32/11_2.png) [@jourdain](https://discourse.paraview.org/u/jourdain)\
**Post date:** [July 6, 2023, 6:04pm UTC](https://discourse.paraview.org/t/problems-with-launcher-py/12440/8 "2023-07-06T18:04:06Z")

</div>

The DELETE is disabled by default.  
You need to `export WSLINK_LAUNCHER_DELETE=1` to enable it.

---

<div class="post-metadata">

**Author:** ![sebasgut1](https://discourse.paraview.org/user_avatar/discourse.paraview.org/sebasgut1/32/11526_2.png) [@sebasgut1](https://discourse.paraview.org/u/sebasgut1)\
**Post date:** [September 12, 2023, 2:21pm UTC](https://discourse.paraview.org/t/problems-with-launcher-py/12440/9 "2023-09-12T14:21:04Z")

</div>

Hi again,  
I was trying to implement WSS, I activated the command lines suggested in the tutorial with apache but I only get https, a new visualization session is created over ‘ws’ not ‘wss’. Do I have to modify something else?  
Thanks

---

<div class="post-metadata">

**Author:** ![sebasgut1](https://discourse.paraview.org/user_avatar/discourse.paraview.org/sebasgut1/32/11526_2.png) [@sebasgut1](https://discourse.paraview.org/u/sebasgut1)\
**Post date:** [September 12, 2023, 2:51pm UTC](https://discourse.paraview.org/t/problems-with-launcher-py/12440/10 "2023-09-12T14:51:57Z")

</div>

I changed the launcher config file from this `"ws://${host}:${port}/ws" `to this `"sessionURL" : "wss://${host}:443/proxy?sessionId=${id}&path=ws"`.  
It seems to work like this.

---

<div class="post-metadata">

**Author:** ![jourdain](https://discourse.paraview.org/user_avatar/discourse.paraview.org/jourdain/32/11_2.png) [@jourdain](https://discourse.paraview.org/u/jourdain)\
**Post date:** [September 13, 2023, 3:17am UTC](https://discourse.paraview.org/t/problems-with-launcher-py/12440/11 "2023-09-13T03:17:26Z")

</div>

For ParaViewWeb indeed, you need to use `wss://...`. For trame with our client and default config, that protocol mapping is automatic. [launcher](https://github.com/Kitware/trame/blob/master/docker/config/default-launcher.json#L8) & [client](https://github.com/Kitware/trame-client/blob/master/vue3-app/src/core/wslink/index.js#L35-L40)

---

<div class="post-metadata">

**Author:** ![sebasgut1](https://discourse.paraview.org/user_avatar/discourse.paraview.org/sebasgut1/32/11526_2.png) [@sebasgut1](https://discourse.paraview.org/u/sebasgut1)\
**Post date:** [September 13, 2023, 9:52am UTC](https://discourse.paraview.org/t/problems-with-launcher-py/12440/12 "2023-09-13T09:52:53Z")

</div>

I was trying to run the apache server on my PC and the launcher.py inside a Docker container but the WSS does not work, it only works like this `"ws://${host}:${port}/ws"`. But if I run both apache server and launcher.py on my PC, it works normally. Why does not it work on a Docker container?

---

<div class="post-metadata">

**Author:** ![jourdain](https://discourse.paraview.org/user_avatar/discourse.paraview.org/jourdain/32/11_2.png) [@jourdain](https://discourse.paraview.org/u/jourdain)\
**Post date:** [September 13, 2023, 2:27pm UTC](https://discourse.paraview.org/t/problems-with-launcher-py/12440/13 "2023-09-13T14:27:05Z")

</div>

The launcher needs to write a mapping file for Apache. It should work as long that file is properly shared between docker and your host (permission and path).

---

<div class="post-metadata">

**Author:** ![sebasgut1](https://discourse.paraview.org/user_avatar/discourse.paraview.org/sebasgut1/32/11526_2.png) [@sebasgut1](https://discourse.paraview.org/u/sebasgut1)\
**Post date:** [September 14, 2023, 7:00am UTC](https://discourse.paraview.org/t/problems-with-launcher-py/12440/14 "2023-09-14T07:00:38Z")

</div>

Thank you so much!
