classification
Title: Can Not import a module with - (DASH) in filename
Type: Stage:
Components: Interpreter Core Versions: Python 2.3
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: bscholln, skip.montanaro
Priority: normal Keywords:

Created on 2004-03-03 18:07 by bscholln, last changed 2004-03-03 20:26 by skip.montanaro. This issue is now closed.

Messages (2)
msg20164 - (view) Author: Benjamin Schollnick (bscholln) Date: 2004-03-03 18:07
I am currently running, Python 2.3.2 (#49, Oct  2 2003, 
20:02:00) [MSC v.1200 32 bit (Intel)] on win32.

I have a file that I am attempting to import "report-
manager.py", that refuses to be imported.

C:\develope\versions>python
Python 2.3.2 (#49, Oct  2 2003, 20:02:00) [MSC v.1200 
32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more 
information.
>>> import report-manager
  File "<stdin>", line 1
    import report-manager
                 ^
SyntaxError: invalid syntax
>>> import "report-manager"
  File "<stdin>", line 1
    import "report-manager"

If this is not a bug, and is indeed expected behavior, is 
this documented in any manner?  I have not found any 
references covering this.
msg20165 - (view) Author: Skip Montanaro (skip.montanaro) * (Python committer) Date: 2004-03-03 20:26
Logged In: YES 
user_id=44345

Yes it is expected and documented behavior.  Module names as 
mentioned in import statements must be valid Python identifiers.  
Hyphens are not allowed in identifiers.  Try renaming the file to 
reportmanager.py or report_manager.py.
History
Date User Action Args
2004-03-03 18:07:57bschollncreate