6

After upgrade pycharm to 2018.1, and upgrade python to 3.6.5, pycharm reports "unresolved reference 'join'". The last version of pycharm doesn't show any warning for the line below:

from os.path import join, expanduser

May I know why?

(I used python 3.6.? before)

I tried almost everything I can find, such as delete and recreate interpreter, invalidate cache and restart, delete and recreate virtualenv... how do I fix this?

(I can run my program without any error.)

Liu Yong
  • 515
  • 5
  • 16
  • Have you tried deleting the folder ~/.PyCharmxxxx.xx/system/python_stubs as mentioned in this question: https://stackoverflow.com/questions/30311954/pycharm-warns-for-unresolved-reference-builtin-datetime-module – FlyingTeller Apr 06 '18 at 08:13
  • I checked there is no folder ".PyCharmxxx" under my home directory – Liu Yong Apr 06 '18 at 08:22
  • 3
    Possible duplicate of [weird behavior when importing os.path](https://stackoverflow.com/questions/49617465/weird-behavior-when-importing-os-path) – user2235698 Apr 07 '18 at 17:54
  • the same problem for a single and new python file. – Liu Yong Apr 08 '18 at 07:50

2 Answers2

0

Sadly, it seems that PyCharm will try to evaluate the path to an existing file/folder, which in some cases will not exist and thus create this warning.

It's not very useful when you are building a path for something that's supposed to be created, because obviously it will not exist yet, but PyCharm will still complain.

You could try clicking on File > Invalidate Caches > Invalidate and Restart. This worked for me.

[edit] It will come back tho, not much else to do.

Ubica
  • 1,011
  • 2
  • 8
  • 18
-1

Check that pycharms is using the correct interpreter.

Patrick Conwell
  • 630
  • 1
  • 5
  • 10
  • Since the program runs without an error this cannot be the issue. Besides, `os.path.join` should be available independent of python interpreter used – FlyingTeller Apr 06 '18 at 08:18