HaveF / feedparser

Automatically exported from code.google.com/p/feedparser
Other
0 stars 0 forks source link

SyntaxError on Installation with Python 3 on Windows using Distribute #330

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Install Distribute on Python 3
2. Attempt to install Feedparser using Distribute

What is the expected output? What do you see instead?
Expected output:
Standard installation

Seen output:
D:\Dropbox\Current Projects\ResearchSpider\feedparser-5.1>py3 setup.py install
running install
running bdist_egg
running egg_info
writing feedparser\feedparser.egg-info\PKG-INFO
writing top-level names to feedparser\feedparser.egg-info\top_level.txt
writing dependency_links to feedparser\feedparser.egg-info\dependency_links.txt
reading manifest file 'feedparser\feedparser.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'feedparser\feedparser.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
creating build\bdist.win-amd64
creating build\bdist.win-amd64\egg
copying build\lib\feedparser.py -> build\bdist.win-amd64\egg
byte-compiling build\bdist.win-amd64\egg\feedparser.py to feedparser.pyc
  File "build\bdist.win-amd64\egg\feedparser.py", line 291
    SUPPORTED_VERSIONS = {'': u'unknown',
                                       ^
SyntaxError: invalid syntax

creating build\bdist.win-amd64\egg\EGG-INFO
copying feedparser\feedparser.egg-info\PKG-INFO -> build\bdist.win-amd64\egg\EGG
-INFO
copying feedparser\feedparser.egg-info\SOURCES.txt -> build\bdist.win-amd64\egg\
EGG-INFO
copying feedparser\feedparser.egg-info\dependency_links.txt -> build\bdist.win-a
md64\egg\EGG-INFO
copying feedparser\feedparser.egg-info\top_level.txt -> build\bdist.win-amd64\eg
g\EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating 'dist\feedparser-5.1-py3.2.egg' and adding 'build\bdist.win-amd64\egg'
to it
removing 'build\bdist.win-amd64\egg' (and everything under it)
Processing feedparser-5.1-py3.2.egg
creating c:\python32\lib\site-packages\feedparser-5.1-py3.2.egg
Extracting feedparser-5.1-py3.2.egg to c:\python32\lib\site-packages
  File "c:\python32\lib\site-packages\feedparser-5.1-py3.2.egg\feedparser.py", l
ine 291
    SUPPORTED_VERSIONS = {'': u'unknown',
                                       ^
SyntaxError: invalid syntax

Adding feedparser 5.1 to easy-install.pth file

Installed c:\python32\lib\site-packages\feedparser-5.1-py3.2.egg
Processing dependencies for feedparser==5.1
Finished processing dependencies for feedparser==5.1

What version of the product are you using? On what operating system?
Feedparser v. 5.1 on Windows 7 64 bit, Python 3

Please provide any additional information below.

This appears to be the relevant issue:

  File "build\bdist.win-amd64\egg\feedparser.py", line 291
    SUPPORTED_VERSIONS = {'': u'unknown',
                                       ^
SyntaxError: invalid syntax

Original issue reported on code.google.com by vGNeSSVg on 17 Feb 2012 at 10:57

GoogleCodeExporter commented 9 years ago
I'm not able to recreate this issue with Python 3.2 on my machine. Currently 
feedparser relies on distribute's ability to automatically convert the source 
code using the 2to3 tool. This feature was added to distribute in version 
0.6.2. What version of distribute do you have installed? Could you also try 
running the following code and reporting back what the output is:

import sys
print(sys.version_info >= (3,))

It should be `True`, otherwise I'll need to figure out a better way to reliably 
check whether the environment is Python 3 or not in setup.py.

Original comment by kurtmckee on 17 Feb 2012 at 12:46

GoogleCodeExporter commented 9 years ago
That comes back as 'True'.

I'm currently using Distribute 0.6.24.

Also, if it helps, feedparser appears to act as if it installed, but when I try 
to import it the same error pops up. Here's an example of just a straight 
import of it:

Python 3.2.2 (default, Sep  4 2011, 09:07:29) [MSC v.1500 64 bit (AMD64)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> import feedparser
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python32\lib\site-packages\feedparser-5.1-py3.2.egg\feedparser.py", l
ine 291
    SUPPORTED_VERSIONS = {'': u'unknown',
                                       ^
SyntaxError: invalid syntax
>>>

Original comment by vGNeSSVg on 18 Feb 2012 at 8:58

GoogleCodeExporter commented 9 years ago
Would you replace feedparser's setup.py file with the file I'm attaching to 
this comment? The difference is that I've hardcoded the `use_2to3` option. Try 
installing the software using a command line like:

    py3 setup3.py install

If that doesn't do the trick, try running the following code in the interactive 
interpreter and post the output (and the output from the above command!).

    import setuptools
    print(setuptools.__file__)

Let me know what happens, and thanks for pasting the results in: that's really 
helpful!

Original comment by kurtmckee on 20 Feb 2012 at 6:54

GoogleCodeExporter commented 9 years ago
The file didn't seem to attach, so I went ahead and hardcoded 'use_2to3' myself 
to try it out and get a faster turnaround time going, so here's the results:

D:\Dropbox\Current Projects\ResearchSpider\feedparser-5.1>py3 setup.py install
running install
running bdist_egg
running egg_info
writing feedparser\feedparser.egg-info\PKG-INFO
writing top-level names to feedparser\feedparser.egg-info\top_level.txt
writing dependency_links to feedparser\feedparser.egg-info\dependency_links.txt
reading manifest file 'feedparser\feedparser.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'feedparser\feedparser.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
creating build\bdist.win-amd64\egg
copying build\lib\feedparser.py -> build\bdist.win-amd64\egg
byte-compiling build\bdist.win-amd64\egg\feedparser.py to feedparser.pyc
  File "build\bdist.win-amd64\egg\feedparser.py", line 291
    SUPPORTED_VERSIONS = {'': u'unknown',
                                       ^
SyntaxError: invalid syntax

creating build\bdist.win-amd64\egg\EGG-INFO
copying feedparser\feedparser.egg-info\PKG-INFO -> build\bdist.win-amd64\egg\EGG
-INFO
copying feedparser\feedparser.egg-info\SOURCES.txt -> build\bdist.win-amd64\egg\
EGG-INFO
copying feedparser\feedparser.egg-info\dependency_links.txt -> build\bdist.win-a
md64\egg\EGG-INFO
copying feedparser\feedparser.egg-info\top_level.txt -> build\bdist.win-amd64\eg
g\EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating 'dist\feedparser-5.1-py3.2.egg' and adding 'build\bdist.win-amd64\egg'
to it
removing 'build\bdist.win-amd64\egg' (and everything under it)
Processing feedparser-5.1-py3.2.egg
removing 'c:\python32\lib\site-packages\feedparser-5.1-py3.2.egg' (and everythin
g under it)
creating c:\python32\lib\site-packages\feedparser-5.1-py3.2.egg
Extracting feedparser-5.1-py3.2.egg to c:\python32\lib\site-packages
  File "c:\python32\lib\site-packages\feedparser-5.1-py3.2.egg\feedparser.py", l
ine 291
    SUPPORTED_VERSIONS = {'': u'unknown',
                                       ^
SyntaxError: invalid syntax

feedparser 5.1 is already the active version in easy-install.pth

Installed c:\python32\lib\site-packages\feedparser-5.1-py3.2.egg
Processing dependencies for feedparser==5.1
Finished processing dependencies for feedparser==5.1

D:\Dropbox\Current Projects\ResearchSpider\feedparser-5.1>py3
Python 3.2.2 (default, Sep  4 2011, 09:07:29) [MSC v.1500 64 bit (AMD64)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> import setuptools
>>> print(setuptools.__file__)
C:\Python32\lib\site-packages\distribute-0.6.24-py3.2.egg\setuptools\__init__.py

Also, on a lark (in other words, the idea just came to me) I went ahead (after 
performing the above steps) and used 2to3 manually on 
\feedparser-5.1\build\lib\feedparser.py with the write flag, and the feedparser 
setup.py installation worked after that. (I import-tested it in the 
interpreter, and ran the script I was previously using Feedparser for to be 
sure)

So it appears that the problem is something to do with actually performing the 
2to3 conversion in setup.py.

Original comment by vGNeSSVg on 20 Feb 2012 at 9:31

GoogleCodeExporter commented 9 years ago
Yeah, I dropped the ball on that attachment. I'm attaching it now for 
completeness. I agree, it looks like something is going on with distribute. I 
searched distribute's bug reports for any clues, and it might be that the 2to3 
process was interrupted at some point [1]. The workaround is to delete the 
build directory.

Would you try deleting the following directories:

    feedparser\feedparser.egg-info
    build\

and see if that solves the problem?

[1]: https://bitbucket.org/tarek/distribute/issue/162/

Original comment by kurtmckee on 20 Feb 2012 at 10:00

Attachments:

GoogleCodeExporter commented 9 years ago
That workaround solves it perfectly. Thanks for your support with all of this.

Original comment by vGNeSSVg on 20 Feb 2012 at 10:09

GoogleCodeExporter commented 9 years ago
No problem, glad to help!

Original comment by kurtmckee on 20 Feb 2012 at 10:16