Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #31722

error executing "import html.parser" from a script

Path csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <renjoki@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'win32': 0.03; 'exception': 0.03; 'attribute': 0.05; 'importerror:': 0.05; 'sys': 0.05; 'python': 0.09; 'exception,': 0.09; 'sep': 0.09; 'subject:script': 0.09; 'way:': 0.09; 'subject:error': 0.11; '(but': 0.15; "skip:' 30": 0.15; '"import': 0.16; 'commented': 0.16; 'subject:import': 0.16; 'sys.path': 0.16; 'script.': 0.17; '>>>': 0.18; 'sender:addr:gmail.com': 0.18; 'windows': 0.19; 'module': 0.19; 'bit': 0.21; 'import': 0.21; '"",': 0.22; 'modifying': 0.22; 'skip:_ 20': 0.22; 'installed': 0.23; 'command': 0.24; 'script': 0.24; 'tried': 0.25; 'skip:[ 10': 0.26; 'skip:" 20': 0.26; '(most': 0.27; 'handling': 0.27; 'message-id:@mail.gmail.com': 0.27; 'skip:( 20': 0.28; 'steps:': 0.29; "skip:' 10": 0.30; 'received:209.85.215.46': 0.30; 'file': 0.32; "skip:' 20": 0.32; 'print': 0.32; 'traceback': 0.33; 'to:addr:python-list': 0.33; 'another': 0.33; 'received:google.com': 0.34; 'received:209.85': 0.35; 'subject:" ': 0.36; 'why': 0.37; 'received:209': 0.37; 'object': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'more': 0.63; 'from:addr:yandex.ru': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type; bh=0yVGXDbGroXuYhY2WJkq1UiuDnB2KizO/+4RguvOun0=; b=E/7ccJAkeUwnyQ37iWwi60POKbCfqcf1//PXD5g+YOkQWJ4DXUAz9eOqr8+ZK7oAmz ELa4WQqnC4Ff+al0XH2lYyZt8jCGcrwbVMzWDlNL3W9DmnybmbKWKJc5PSaKZqfja+Fz fHE7L+u37wmTsABDtmH0m1KKaca9RGREkkGR2+l+iJsCWYfzBi+xLF5WFW/jR/QkpY/4 bhSbwWbFgfsVAn56zDtD2io7bkNCHcf7JvCbHOIzBTFvKsmh5Dt2NBAlAbaqEI+IxzGq VGKpc+5RPTUx2LIt8IiduooJ4/MmnJFe7G+qvmuGa1lsNH9Ittt+3AVPQ26PMnkgI/jI nwDg==
MIME-Version 1.0
Sender renjoki@gmail.com
Date Fri, 19 Oct 2012 13:15:45 +0400
X-Google-Sender-Auth qWiQvEfMXJwX7N-6-jS3XUbo3fY
Subject error executing "import html.parser" from a script
From Paul Volkov <capt-obvious@yandex.ru>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2500.1350638147.27098.python-list@python.org> (permalink)
Lines 61
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1350638147 news.xs4all.nl 6971 [2001:888:2000:d::a6]:54718
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:31722

Show key headers only | View raw


What is this madness?
I have Python 3.3.0 installed on Windows XP. I do not have Python 2
(but I had it before). I do the following steps:

1. Import from an interactive session (no problems)

>python
Python 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:55:48) [MSC v.1600
32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import html
>>> import html.parser
>>> ^Z

2. Import from command line (no problems)

>python -c "import html.parser"

3. Import from a script. The script contains only one import line.
Everything else is commented out.

>python e:\tmp\pyt\html.py
Traceback (most recent call last):
  File "<frozen importlib._bootstrap>", line 1512, in _find_and_load_unlocked
AttributeError: 'module' object has no attribute '__path__'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "e:\tmp\pyt\html.py", line 7, in <module>
    import html.parser
  File "e:\tmp\pyt\html.py", line 7, in <module>
    import html.parser
ImportError: No module named 'html.parser'; html is not a package

4. And then I tried to print sys.path from my script by modifying it this way:
import sys
print (sys.path)
import html.parser

And the result is: (I don't know why sys.path is printed twice)

>python e:\tmp\pyt/html.py
['e:\\tmp\\pyt', 'D:\\WINDOWS\\system32\\python33.zip',
'D:\\Python33\\DLLs', 'D:\\Python33\\lib', '
D:\\Python33', 'D:\\Python33\\lib\\site-packages']
['e:\\tmp\\pyt', 'D:\\WINDOWS\\system32\\python33.zip',
'D:\\Python33\\DLLs', 'D:\\Python33\\lib', '
D:\\Python33', 'D:\\Python33\\lib\\site-packages']
Traceback (most recent call last):
  File "<frozen importlib._bootstrap>", line 1512, in _find_and_load_unlocked
AttributeError: 'module' object has no attribute '__path__'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "e:\tmp\pyt/html.py", line 8, in <module>
    import html.parser
  File "e:\tmp\pyt\html.py", line 8, in <module>
    import html.parser
ImportError: No module named 'html.parser'; html is not a package

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

error executing "import html.parser" from a script Paul Volkov <capt-obvious@yandex.ru> - 2012-10-19 13:15 +0400
  Re: error executing "import html.parser" from a script Hans Mulder <hansmu@xs4all.nl> - 2012-10-19 12:48 +0200

csiph-web