13

I encountered the Invalid name for Python module: ...filename (it'll not be analyzed) warning message in PyDev and I tried to resolve it by replacing - in the filename with _ but the warning didn't disappeared.

One of the problems is that in fact this is not a module, it's just a python script, still I get the warning and the warning says nothing about how to solve the issue.

What are the real requirements for filenames (not necessary modules) and where are they specified (PIP)?

How do I solve this problem in PyDev?

3
  • 1
    A "python script" is a python module. Commented Sep 26, 2011 at 8:18
  • What is the module name? Commented Sep 26, 2011 at 8:21
  • The filename. See my answer for what's valid in a module name. Commented Sep 26, 2011 at 8:22

2 Answers 2

16

See http://docs.python.org/tutorial/modules.html for information about modules.

To find out what characters are valid, have a look at the syntax of the import statement. It shows you that a module name needs to be a valid identifier which has the following rule:

identifier ::=  (letter|"_") (letter | digit | "_")*
Sign up to request clarification or add additional context in comments.

2 Comments

In fact, the problem was the usage of "." in the filename, not the "_", marked as solved.
The '-' characters is also not valid in filename.
0

I had the similar message and when I checked the script file name, I had a "-" [dash character] in the script name. After I removed the dash character and replaced with " _ " [an under score character], the warning message was gone.

1 Comment

It's better to ask a separate question if your question is even slightly different. Please see stackoverflow.com/questions/51030905

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.