Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use current file as parameter to Run configuration in pycharm

I want to create custom run configurations, but i cannot figure out how to get the current file name as a parameter...

I would like to do something like this:

py.test -m mymarker %f

autopep8 %f

where %f is the current file name.

like image 491
timeyyy Avatar asked Aug 14 '15 12:08

timeyyy


1 Answers

The answer by Ctrl+C already hints at $FileName$ and at least in the current version 2020.2 of PyCharm this works in Run Configurations.

  1. Create a run configuration as you desire, e.g. Python
  2. In Parameters field you can simply use macros like $FileName$ or $FilePath$. Or click on the + at the right end for a full list
  3. Hit the Run button or Shift+F10 by default while your target file is opened
like image 162
Florian Magin Avatar answered Sep 30 '22 17:09

Florian Magin