Questions tagged [pycharm]

PyCharm is an integrated development environment (IDE) for Python. It is developed by JetBrains for Windows, Mac OS X and Linux.

PyCharm is an integrated development environment (IDE) for Python, developed by JetBrains. It is available on Windows, OS X and Linux.

It provides support for common Python frameworks such as Django, Flask, Pyramid and others.

Starting with version 3, a free and open-source edition of PyCharm was released; along with a professional (paid) edition.

If you have found a bug, it is usually better to report it at the public bug tracker.

For more information, browse the following:

  1. The official product page.
  2. The public bugtracker.
  3. Product blog.
  4. Support page.
13660 questions
660
votes
6 answers

How do I type hint a method with the type of the enclosing class?

I have the following code in python 3: class Position: def __init__(self, x: int, y: int): self.x = x self.y = y def __add__(self, other: Position) -> Position: return Position(self.x + other.x, self.y +…
Michael van Gerwen
  • 6,731
  • 3
  • 9
  • 8
429
votes
23 answers

Unresolved reference issue in PyCharm

I have a directory structure ├── simulate.py ├── src │   ├── networkAlgorithm.py │   ├── ... And I can access the network module with sys.path.insert(). import sys import os.path sys.path.insert(0, "./src") from networkAlgorithm import…
prosseek
  • 155,475
  • 189
  • 518
  • 818
309
votes
29 answers

PyCharm shows unresolved references error for valid code

I am using PyCharm to work on a project. The project is opened and configured with an interpreter, and can run successfully. The remote interpreter paths are mapped properly. This seems to be the correct configuration, but PyCharm is highlighting…
James McCalden
  • 3,386
  • 2
  • 13
  • 18
304
votes
6 answers

How do I set the maximum line length in PyCharm?

I am using PyCharm on Windows and want to change the settings to limit the maximum line length to 79 characters, as opposed to the default limit of 120 characters. Where can I change the maximum amount of characters per line in PyCharm?
Ansuman Bebarta
  • 5,781
  • 6
  • 23
  • 42
283
votes
2 answers

Simplify Chained Comparison

I have an integer value x, and I need to check if it is between a start and end values, so I write the following statements: if x >= start and x <= end: # do stuff This statement gets underlined, and the tooltip tells me that I must simplify…
Brynn McCullagh
  • 3,673
  • 2
  • 12
  • 12
267
votes
7 answers

How to make PyCharm always show line numbers

I cannot seem to be able to find the setting to enable line numbers for all files, but I have to always right click and enable this on per file basis. There must be a global setting for this, right?
Kimvais
  • 34,273
  • 14
  • 100
  • 135
255
votes
3 answers

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…
Jan Zyka
  • 15,968
  • 15
  • 63
  • 105
247
votes
8 answers

What is the problem with shadowing names defined in outer scopes?

I just switched to PyCharm and I am very happy about all the warnings and hints it provides me to improve my code. Except for this one which I don't understand: This inspection detects shadowing names defined in outer scopes. I know it is bad…
Framester
  • 27,123
  • 44
  • 121
  • 183
216
votes
10 answers

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…
maligree
  • 5,434
  • 10
  • 32
  • 48
210
votes
13 answers

Word wrapping in PhpStorm

How can I enable word wrapping in PhpStorm? I need to enable it only for some of my files (with extension .txt). Is it possible?
Hast
  • 8,664
  • 5
  • 42
  • 64
208
votes
13 answers

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…
smurff
  • 2,331
  • 3
  • 11
  • 7
205
votes
5 answers

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…
Chris Sears
  • 5,533
  • 4
  • 28
  • 33
192
votes
19 answers

"UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure." when plotting figure with pyplot on Pycharm

I am trying to plot a simple graph using pyplot, e.g.: import matplotlib.pyplot as plt plt.plot([1,2,3],[5,7,4]) plt.show() but the figure does not appear and I get the following message: UserWarning: Matplotlib is currently using agg, which is a…
johnwolf1987
  • 4,797
  • 3
  • 10
  • 13
180
votes
10 answers

Why does pycharm propose to change method to static

The new pycharm release (3.1.3 community edition) proposes to convert the methods that don't work with the current object's state to static. What is the practical reason for that? Some kind of micro-performance(-or-memory)-optimization?
zerkms
  • 230,357
  • 57
  • 408
  • 498
179
votes
14 answers

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…
Claus
  • 3,871
  • 4
  • 16
  • 15
1
2 3
99 100