0

I wish for a specific module to be inserted at the head of the syspath before I debug a file so that this module is picked up instead of a different version of the module in a release location.

e.g. run this code after I click the Debug button in PyCharm:

import sys; sys.path.insert(0, "/my/local/path")

does anybody know how to do this in PyCharm?

at the moment I'm copying in this line of code at the top of the file I am debugging but this is messy and I shouldn't be messing with live code like that in case i make a commit by mistake.

yole
  • 92,896
  • 20
  • 260
  • 197
Cybran
  • 303
  • 2
  • 5
  • This method is actually not solving my problem... I wish to be able to set breakpoints in this other file that the initial file is calling and catch those breakpoints when debugging. However, at the moment it is skipping this other file and it's breakpoints calling the pyc of the file instead.... any ideas folks? thanks – Cybran Mar 05 '14 at 12:43
  • I would still like to know the answer for the original question btw! – Cybran Mar 05 '14 at 12:45

1 Answers1

0

+1 to your question. And I found the answer here https://stackoverflow.com/a/15282950/707580.

  1. use virtualenvwrapper

  2. run (yourvenv)$ add2virtualenv /my/local/path

If you know about virtualenv, I think the above bullets are straight forward. If not, leave me a comment and I will try to elaborate what's useful.

Community
  • 1
  • 1
hbrls
  • 2,110
  • 5
  • 32
  • 53