PyCharm error: ‘No Module’ when trying to import own module (python script)

I have written a module (a file my_mod.py file residing in the folder my_module). Currently, I am working in the file cool_script.py that resides in the folder cur_proj. I have opened the folder in PyCharm using File — open (and I assume, hence, it is a PyCharm project). In ProjectView (CMD-7), I can see my … Read more

Why does Pycharm’s inspector complain about “d = {}”?

When initializing a dictionary with d = {} Pycharm’s code inspector generates a warning, saying This dictionary creation could be rewritten as a dictionary literal. If I rewrite it d = dict() the warning goes away. Since {} already is a dictionary literal, I’m pretty sure the message is erroneous. Furthermore, it seems like both … Read more

How do I use installed packages in PyCharm?

In PyCharm, I’ve added the Python environment /usr/bin/python. However, from gnuradio import gr fails as an undefined reference. However, it works fine in the Python interpreter from the command line. GNURadio works fine with python outside of Pycharm. Everything is installed and configured how I want it. Gnuradio is located at /usr/local/lib/python2.7/site-packages/gnuradio Also: PYTHONPATH=/usr/local/lib/python2.7/site-packages:/usr/local/lib/python2.7/site-packages/gnuradio 13 … Read more

Is there a difference between using a dict literal and a dict constructor?

Using PyCharm, I noticed it offers to convert a dict literal: d = { ‘one’: ‘1’, ‘two’: ‘2’, } into a dict constructor: d = dict(one=”1″, two=’2′) Do these different approaches differ in some significant way? (While writing this question I noticed that using dict() it seems impossible to specify a numeric key .. d … Read more

How to navigate through the source code by parts in CamelCase (instead of whole words)?

I remember when I was using Eclipse that when holding CTRL and using left or right arrows Eclipse would navigate over the LongCamelCaseWrittenWord in several steps. One camel case word at time. So it will go like follows (pipe | represents the actual cursor position): |LongCamelCaseWrittenWord -> CTRL+RIGHT_ARROW -> Long|CamelCaseWrittenWord -> CTRL+RIGHT_ARROW -> LongCamel|CaseWrittenWord -> … Read more