Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #31385 > unrolled thread
| Started by | graham <grahams@tectime.com> |
|---|---|
| First post | 2012-10-16 12:29 +0100 |
| Last post | 2012-10-20 14:47 +0200 |
| Articles | 13 — 8 participants |
Back to article view | Back to comp.lang.python
Python on Windows graham <grahams@tectime.com> - 2012-10-16 12:29 +0100
Re: Python on Windows Marco Nawijn <nawijn@gmail.com> - 2012-10-16 04:35 -0700
Re: Python on Windows Dwight Hutto <dwightdhutto@gmail.com> - 2012-10-16 07:56 -0400
Re: Python on Windows Joel Goldstick <joel.goldstick@gmail.com> - 2012-10-16 07:44 -0400
Re: Python on Windows graham <grahams@tectime.com> - 2012-10-19 14:24 +0100
Re: Python on Windows Tim Golden <mail@timgolden.me.uk> - 2012-10-19 14:44 +0100
Re: Python on Windows rusi <rustompmody@gmail.com> - 2012-10-19 06:48 -0700
Re: Python on Windows Tim Golden <mail@timgolden.me.uk> - 2012-10-19 15:00 +0100
Re: Python on Windows graham <grahams@tectime.com> - 2012-10-19 15:12 +0100
Re: Python on Windows Tim Golden <mail@timgolden.me.uk> - 2012-10-19 15:24 +0100
Re: Python on Windows Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-10-19 15:23 +0100
Re: Python on Windows Tim Golden <mail@timgolden.me.uk> - 2012-10-19 15:40 +0100
Re: Python on Windows Gisle Vanem <gvanem@broadpark.no> - 2012-10-20 14:47 +0200
| From | graham <grahams@tectime.com> |
|---|---|
| Date | 2012-10-16 12:29 +0100 |
| Subject | Python on Windows |
| Message-ID | <1pKdnT9EiNaO2ODNnZ2dnUVZ8rCdnZ2d@bt.com> |
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
[toc] | [next] | [standalone]
| From | Marco Nawijn <nawijn@gmail.com> |
|---|---|
| Date | 2012-10-16 04:35 -0700 |
| Message-ID | <63069c5e-2979-47db-828a-39570899452f@googlegroups.com> |
| In reply to | #31385 |
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".
>
>
>
> There is a feedparser.py file lurking around - so I suppose Python
>
> cannot find it.
>
>
>
> Anyone: What to do?
>
>
>
>
>
>
>
> GC
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
[toc] | [prev] | [next] | [standalone]
| From | Dwight Hutto <dwightdhutto@gmail.com> |
|---|---|
| Date | 2012-10-16 07:56 -0400 |
| Message-ID | <mailman.2267.1350388611.27098.python-list@python.org> |
| In reply to | #31386 |
On Tue, Oct 16, 2012 at 7:35 AM, Marco Nawijn <nawijn@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
[toc] | [prev] | [next] | [standalone]
| From | Joel Goldstick <joel.goldstick@gmail.com> |
|---|---|
| Date | 2012-10-16 07:44 -0400 |
| Message-ID | <mailman.2264.1350387882.27098.python-list@python.org> |
| In reply to | #31385 |
On Tue, Oct 16, 2012 at 7:29 AM, graham <grahams@tectime.com> 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". > > There is a feedparser.py file lurking around - so I suppose Python cannot > find it. > > Anyone: What to do? > > 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
[toc] | [prev] | [next] | [standalone]
| From | graham <grahams@tectime.com> |
|---|---|
| Date | 2012-10-19 14:24 +0100 |
| Message-ID | <JY2dnYfmpcsEyRzNnZ2dnUVZ8vadnZ2d@bt.com> |
| In reply to | #31385 |
On 16/10/2012 12:29, 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". > > There is a feedparser.py file lurking around - so I suppose Python > cannot find it. > > Anyone: What to do? > > > > GC > 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
[toc] | [prev] | [next] | [standalone]
| From | Tim Golden <mail@timgolden.me.uk> |
|---|---|
| Date | 2012-10-19 14:44 +0100 |
| Message-ID | <mailman.2506.1350654285.27098.python-list@python.org> |
| In reply to | #31740 |
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
[toc] | [prev] | [next] | [standalone]
| From | rusi <rustompmody@gmail.com> |
|---|---|
| Date | 2012-10-19 06:48 -0700 |
| Message-ID | <4000dfaf-4ed9-4048-8aa7-530978cddcae@vy11g2000pbb.googlegroups.com> |
| In reply to | #31740 |
On Oct 19, 6:24 pm, graham <grah...@tectime.com> wrote: > On 16/10/2012 12:29, 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". > > > There is a feedparser.py file lurking around - so I suppose Python > > cannot find it. > > > Anyone: What to do? > > > GC > > 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 Just try taking your ubuntu's /usr/share/pyshare/feedparser.py onto your windows box?? [UNTESTED]
[toc] | [prev] | [next] | [standalone]
| From | Tim Golden <mail@timgolden.me.uk> |
|---|---|
| Date | 2012-10-19 15:00 +0100 |
| Message-ID | <mailman.2508.1350655217.27098.python-list@python.org> |
| In reply to | #31740 |
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
[toc] | [prev] | [next] | [standalone]
| From | graham <grahams@tectime.com> |
|---|---|
| Date | 2012-10-19 15:12 +0100 |
| Message-ID | <rYmdnUnPSeltwhzNnZ2dnUVZ8t-dnZ2d@bt.com> |
| In reply to | #31740 |
On 19/10/2012 14:24, graham wrote: > On 16/10/2012 12:29, 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". >> >> There is a feedparser.py file lurking around - so I suppose Python >> cannot find it. >> >> Anyone: What to do? >> >> >> >> GC >> > > 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 > > 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
[toc] | [prev] | [next] | [standalone]
| From | Tim Golden <mail@timgolden.me.uk> |
|---|---|
| Date | 2012-10-19 15:24 +0100 |
| Message-ID | <mailman.2510.1350656685.27098.python-list@python.org> |
| In reply to | #31745 |
[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
[toc] | [prev] | [next] | [standalone]
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
|---|---|
| Date | 2012-10-19 15:23 +0100 |
| Message-ID | <mailman.2509.1350656588.27098.python-list@python.org> |
| In reply to | #31740 |
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.
[toc] | [prev] | [next] | [standalone]
| From | Tim Golden <mail@timgolden.me.uk> |
|---|---|
| Date | 2012-10-19 15:40 +0100 |
| Message-ID | <mailman.2512.1350657653.27098.python-list@python.org> |
| In reply to | #31740 |
On 19/10/2012 15:23, Mark Lawrence wrote: > 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 :) > 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
[toc] | [prev] | [next] | [standalone]
| From | Gisle Vanem <gvanem@broadpark.no> |
|---|---|
| Date | 2012-10-20 14:47 +0200 |
| Message-ID | <mailman.2560.1350740919.27098.python-list@python.org> |
| In reply to | #31740 |
"Tim Golden" <mail@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
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web