Skip to content
Snippets Groups Projects
Commit 08c164f8 authored by Dimitar Tasev's avatar Dimitar Tasev
Browse files

Added section about running independent widgets in PyCharm, re #21593

parent aac98fcf
No related branches found
No related tags found
No related merge requests found
......@@ -32,7 +32,7 @@ Developing and debugging with PyCharm on Windows
################################################
The first thing that needs to be done is creating the PyCharm project and configuring the project settings. Please follow the instructions at :ref:`GettingStartedWithPyCharm`.
After the project settings have been configured, a Run/Debug configuration needs to be created. To edit the configurations go to ``Run->Run...`` and select ``Edit Configurations``. Select ``Templates->Python``, and hit the green ``+`` in the top left.
After the project settings have been configured, a Run/Debug configuration needs to be created. To edit the configurations go to ``Run->Run...`` and select ``Edit Configurations``. Select ``Templates->Python``, and hit the green ``+`` in the top left.
The necessary changes to the configuration are:
- Select the Mantid Python interpreter that was added to the project in the instructions above. Do not use the default interpreter on Windows.
......@@ -46,7 +46,7 @@ Paths for running a Release build:
- Set the *Script Path* to ``<Mantid Build Directory>/bin/Release/workbench-script.pyw``
- Set the *Working Directory* to ``<Mantid Build Directory>/bin/Release``
Note that the only difference here is the change from ``/bin/Debug/`` to ``/bin/Release/``.
Note that the only difference here is the change from ``/bin/Debug/`` to ``/bin/Release/``.
Make sure you have finished the build you are using (Debug or Release), or there will be import errors.
......@@ -63,7 +63,7 @@ Common errors
The fix for these errors is to make sure you have **started** PyCharm through the ``<Mantid Build Directory>/pycharm.bat`` script. This sets up the ``PATH`` variable for the Python imports.
Additionally, check that your PyCharm Run/Debug configuration *does not* overwrite the ``PATH`` variable.
Additionally, check that your PyCharm Run/Debug configuration *does not* overwrite the ``PATH`` variable.
To check go to ``Edit Configurations -> Environment Variables`` and click the folder icon on the right side. In the ``Name`` column there should not be a ``Path`` variable.
If there is one, try deleting it and running your configuration again.
......@@ -77,3 +77,13 @@ Follow these steps to narrow down the root of potential errors:
- Try to import the package where the error is happening. For example if there is an error on ``import qtpy``, ``from PyQt5 import QtCore``, try running that line in the interpreter.
- If the import succeeds, then there is a problem with the ``PATH`` configuration in PyCharm.
- If the import fails, then it is possible that Mantid has not been fully built. If you are trying to import ``PyQt4``/``PyQt5``/``qtpy``, and it fails to import from the command prompt, then the ``external`` dependencies might not be downloaded or are corrupted.
Running other Mantid widgets in PyCharm
---------------------------------------
The widgets in ``mantidqt/widgets`` can be run independently of the Workbench. They still need the relevant PATHs available - to load the ``mantid` and ``mantidqt`` libraries.
The easiest way to do this is to set the script path to the widget's script that can start it, but leave the working directory to point at `<Mantid Build Directory>/bin/Debug` or `<Mantid Build Directory>/bin/Release`
For example to run the MatrixWorkspaceDisplay, copy your default configuration (on the right of the ``-``).
Set the Script Path to ``<Mantid Source Dir>/qt/python/mantidqt/widgets/matrixworkspaceviewer/run.py``.
Leave the working directory to ``<Mantid Build Dir>/bin/Debug``.
Running the configration should start the MatrixWorkspaceDisplay.
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment