Pycharm error: Cannot determine module type ("WEB_MODULE")

jon_two picture jon_two · Oct 1, 2015 · Viewed 9.3k times · Source

I'm using Pycharm Professional 4.5.4 to develop a javascript project and was seeing some odd behaviour when opening the project in the browser.

The project structure is something like

/MyProject
    /data
    /images
    /python
    /etc
    /webapp
    /webapp_copy

I was trying out a few changes in the webapp_copy folder, but when I launched in the browser, pycharm launched the webapp version of the site. No idea why it was doing this, maybe because the structure and contents were similar.

Anyway, I closed the project and reopened just the webapp_copy folder. Now I'm getting the error Cannot determine module type ("WEB_MODULE") for the following module:"webapp_copy".

When I browse the .idea folder and look at webapp_copy.iml, is does indeed say

<module type="WEB_MODULE" version="4">

Why would Pycharm label this module as a web module, then later claim it doesn't know what a web module is?

I've tried searching, but I either get results for IntelliJ or something about python modules. https://www.jetbrains.com/idea/help/supported-module-types.html

UPDATE: I've raised this as an issue with JetBrains - feel free to vote on it! https://youtrack.jetbrains.com/issue/PY-17084

Answer

Todd L picture Todd L · Oct 1, 2015

When I had a similar problem (type="RUBY_MODULE") it was because I had opened the directory containing the code originally using RubyMine so it created the .idea directory/content based on what it supports.

I don't know if you (or someone else) originally used something else that created the .idea directory so YMMV, but per the link you listed, the WEB_MODULE type only seems to apply to IntelliJ Ultimate.

To fix this, simply change the type to PYTHON_MODULE in the .iml file, restart PyCharm and the warning should go away. If you are, in fact, using IntelliJ, you should be fine as PYTHON_MODULE is supported by the Ultimate edition per your link (although you may have to install a specific python add-in).