I have got simple pcov.py script in PyCharm using optparse
from optparse import OptionParser
As I understand PyCharm has every project in its own virtual environment. My package has the following packages installed (Project: pcov.py > Project interpreter):
- argparse
- pip
- setuptools
- wheel
- wsgiref
My project works fine within PyCharm in respect to parsing command line options:
parser = OptionParser(usage=usage)
...
parser.add_option("-z", action="store_true", dest="clean_build",
help="Clean all intermediate files")
...
Sadly, it doesn't when I try to run it standalone (from the command line) saying to me incomprenesible:
./pcov.py -z
[the pcov.py hangs here and I had to kill it with Ctrl-C]
from: can't read /var/mail/optparse
./pcov.py: line 9: syntax error near unexpected token ('
./pcov.py: line 9: def pselect(choices):'
Note that PyCharm never complains of no syntax errors and PyCharm handles -z command line option nicely.
I thought at first that I have to install some more package globally', but I didn't find
optparse' python package (pip search optparse) showed me no exact match.
Thus my questions:
1) What packages I have to install (pip install ) to make my pcov.py script running as it does under PyCharm ?
2) Is there an automated way 'to deliver' the PyCharm working script as a standalone Python script?
Using PyCharm CE 2017.0, Debian 8 jessie, python 2.7