Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Python on Windows

107 views
Skip to first unread message

graham

unread,
Oct 16, 2012, 7:29:21 AM10/16/12
to

Downloaded and installed Python 2.7.3 for windows (an XP machine).

Entered the Python interactive interpreter/command line and typed the
following:

>>>import feedparser

and I get the error message "No module named feedparser".

There is a feedparser.py file lurking around - so I suppose Python
cannot find it.

Anyone: What to do?



GC

Marco Nawijn

unread,
Oct 16, 2012, 7:35:19 AM10/16/12
to
Hi,

feedparser.py is not a Python standard library. So, if it feedparser is located in a non-standard folder you have at least the following two options:
1. Update the PYTHONPATH environment variable such that it includes the path the installation location of feedparser.py

2. Add the path to feedparser.py directly in the script that uses it. Something like the following:
import sys
sys.path.append("path to feedparser.py")

import feedparser

Regards,

Marco

Joel Goldstick

unread,
Oct 16, 2012, 7:44:36 AM10/16/12
to graham, pytho...@python.org
I'm guessing your python path is not set up. Look here:
http://docs.python.org/using/windows.html

or google windows xp setting python path


>
> GC
>
> --
> http://mail.python.org/mailman/listinfo/python-list



--
Joel Goldstick

Dwight Hutto

unread,
Oct 16, 2012, 7:56:49 AM10/16/12
to Marco Nawijn, pytho...@python.org
On Tue, Oct 16, 2012 at 7:35 AM, Marco Nawijn <naw...@gmail.com> wrote:
> On Tuesday, October 16, 2012 1:29:23 PM UTC+2, graham wrote:
>> Downloaded and installed Python 2.7.3 for windows (an XP machine).
>>
>>
>>
>> Entered the Python interactive interpreter/command line and typed the
>>
>> following:
>>
>>
>>
>> >>>import feedparser
>>
>>
>>
>> and I get the error message "No module named feedparser".
>>
>>

Did you install it into the site-packages directory? Or did you cd to
the directory it's in, and launch, or place it into the directory
you're trying to launch it from?
>>


--
Best Regards,
David Hutto
CEO: http://www.hitwebdevelopment.com

graham

unread,
Oct 19, 2012, 9:24:34 AM10/19/12
to
Thanks to everyone who replied.

Python was installed in the subdirectory C:\Python27 with the file
feedparser.py residing in C:\Python27\Lib\email.

Setting the Windows environment variable (which did not previously
exist) to C:\Python27\Lib\email allowed me to import feedparser
successfully.

However, it seems that this feedparser module is not the module I wanted.

I'm trying to follow an introductory Python course from the magazine
Linux Format (issue number 120 I think). The article includes the
following lines:

>>> import feedparser
>>> url = “http://weather.yahooapis.com/forecastrss?p=UKXX0637&u=c
>>> data = feedparser.parse(url)

This is fine using Ubuntu (after installing the feedparser package) but
now, running XP I get

>>> data = feedparser.parse(url)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'parse'



So there seems to be at least 2 feedparser modules - the one I have does
not include "parse". How can I identify the correct one? How do I

This is all confusing and frustrating.

Some searching suggests I need the 'universal feed parser' code. I can
find documentation for this but no code/module file. Is it available
only for Unix-like OS's?

GC






Tim Golden

unread,
Oct 19, 2012, 9:44:34 AM10/19/12
to pytho...@python.org
On 19/10/2012 14:24, graham wrote:
> Thanks to everyone who replied.
>
> Python was installed in the subdirectory C:\Python27 with the file
> feedparser.py residing in C:\Python27\Lib\email.
>
> Setting the Windows environment variable (which did not previously
> exist) to C:\Python27\Lib\email allowed me to import feedparser
> successfully.
>
> However, it seems that this feedparser module is not the module I wanted.
>
> I'm trying to follow an introductory Python course from the magazine
> Linux Format (issue number 120 I think).


I'm very surprised that the article tells you to import a non-standard
module without telling you where to download it. I imagine that the
module is this one:

http://pypi.python.org/pypi/feedparser/

(In general, PyPI is the first place to look for Python packages).

> This is all confusing and frustrating.

Understandably. It's not unknown, but it is unusual for two
identically-named packages to exist for Python. It's more
unfortunate when it's one used in a beginner's article.

If you understand how to download the .zip file from the page above and
unzip it then you need to go to the directory where the unzipped files
are and run:

python setup.py install

If you're not sure how to do any of that, feel free to post back here or
to the python-tutor list [1] which is a little more experience in
helping newcomers.

TJG

[1] http://mail.python.org/mailman/listinfo/tutor


rusi

unread,
Oct 19, 2012, 9:48:30 AM10/19/12
to
Just try taking your ubuntu's /usr/share/pyshare/feedparser.py onto
your windows box??
[UNTESTED]

Tim Golden

unread,
Oct 19, 2012, 10:00:13 AM10/19/12
to pytho...@python.org
On 19/10/2012 14:24, graham wrote:
> Python was installed in the subdirectory C:\Python27 with the file
> feedparser.py residing in C:\Python27\Lib\email.
>
> Setting the Windows environment variable (which did not previously
> exist) to C:\Python27\Lib\email allowed me to import feedparser
> successfully.

As an aside, this is not the best use of the PYTHONPATH
variable. (I would argue that, on Windows at least, there's very little
need for the env var).

In general, you'll want to be using a mechanism such as pip:

http://pypi.python.org/pypi/pip

which will look things up on PyPI so you can just do "pip install
newmodule". This will install into c:\python27\lib\site-packages. The
same for a module you install "manually" (ie python setup.py install) or
via an .exe or an .msi from PyPI or elsewhere.

There are other possibilities: .pth files, the PYTHONPATH env var,
virtualenv, user-install directories which you can read about, but in
general, just let the standard mechanisms install into
c:\python27\lib\site-packages (which is automatically on sys.path) and
go from there.

TJG

graham

unread,
Oct 19, 2012, 10:12:57 AM10/19/12
to
On 19/10/2012 14:24, graham wrote:
Once again thanks to those that replied.

Since I posted, I found a version 4.1 on sourceforge.

I guessed/muddled my way through installation and it seems to work.

To Tom Golden,
Thanks for the link to http://pypi.python.org/pypi/feedparser/ - I
couldn't find it and I don't know how you did.

The version at http://pypi.python.org/pypi/feedparser/ is 5.1. Can I
simply install 'over the top' of the previous one or do I need to
uninstall V4.1?


GC







Mark Lawrence

unread,
Oct 19, 2012, 10:23:54 AM10/19/12
to pytho...@python.org
On 19/10/2012 14:44, Tim Golden wrote:
>
> (In general, PyPI is the first place to look for Python packages).
>
>

For the benefit of the OP and others this is worth reading on how to get
Python packages from pypi that let you get Python packages from pypi
http://stackoverflow.com/questions/4750806/how-to-install-pip-on-windows :)

--
Cheers.

Mark Lawrence.

Tim Golden

unread,
Oct 19, 2012, 10:24:41 AM10/19/12
to pytho...@python.org
[Could I suggest snipping some of the preceding replies unless you're
referring directly to them? Just leave enough to make the context clear]

[... attempts to find feedparser module for beginner's tutorial ...]

On 19/10/2012 15:12, graham wrote:
> Once again thanks to those that replied.
>
> Since I posted, I found a version 4.1 on sourceforge.
>
> I guessed/muddled my way through installation and it seems to work.
>
> To Tom Golden,
> Thanks for the link to http://pypi.python.org/pypi/feedparser/ - I
> couldn't find it and I don't know how you did.

At least from where I'm standing, it's the second Google result for
"python feedparser" but in fact I Googled for "PyPI feedparser" because
I knew that that was the most likely bet.

>
> The version at http://pypi.python.org/pypi/feedparser/ is 5.1. Can I
> simply install 'over the top' of the previous one or do I need to
> uninstall V4.1?

You should just be able to over-install. No harm in deleting the
previous one, but you probably don't need to.

TJG

Tim Golden

unread,
Oct 19, 2012, 10:40:49 AM10/19/12
to pytho...@python.org
Heh. I avoided trying to explain how to install pip because the OP
seemed unfamiliar with enough concepts already. It never occurred to me
to use easy_install to install pip!

TJG

Gisle Vanem

unread,
Oct 20, 2012, 8:47:51 AM10/20/12
to pytho...@python.org
"Tim Golden" <ma...@timgolden.me.uk> wrote:

> In general, you'll want to be using a mechanism such as pip:
>
> http://pypi.python.org/pypi/pip
>
> which will look things up on PyPI so you can just do "pip install
> newmodule".

And if you have a pip.bat from some Perl installation sitting before
python's Scripts dir in your %PATH, remember to use
"pip.exe install newmodule" instead.

My Strawberry Perl has this "Perl Installation Package". Maybe I should
rearrange my %PATH?

--gv
0 new messages