PyCharm IDE

fonsecareyna82 edited this page Jul 17, 2018 · 10 revisions

PyCharm IDE

Getting started

  • Download PyCharm's community version here. Install following the instructions for your platform.
  • Clone Scipion git repository in your machine: git clone https://github.com/I2PC/scipion.git
  • Create a new Scipion project (Choose "open" in the open project dialog and select your scipion directory).

Debugging

There is a couple of commands that we need to run before starting PyCharm in order to be able to debug Scipion and use the "Attach to local process" option. A handy way is to generate PyCharm's command line launcher and modify it:

1a. Edit .bashrc file and include LD_LIBRARY_PATH= <our-scipion-home>/software/lib/

1b. Generate Pycharm's command line launcher

Click on Tools > Create command line launcher... and type the desired path to the script.

1c. Find PyCharm's command line launcher if already have one

$ which charm
/usr/local/bin/charm
  1. Open the init script as root
$ sudo vim /usr/local/bin/charm
  1. In the function def process_args(argv):, add the code in bold. Remember to replace <your-scipion-home> with the right path and save your changes:
...
elif arg == 'merge' and i == 0:
    args.append(arg)
elif arg == 'debug':
    os.system("export LD_LIBRARY_PATH=<your-scipion-home>/software/lib/")
    os.system("echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope")
elif arg == '-l' or arg == '--line':
...
  1. Start pycharm from your terminal with your new debug option - will prompt you to enter your password.
$ charm debug
[sudo] password for <your-user>:
  1. Happy debugging!
Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.