[cc-devel] [ cctools-Bugs-1758822 ] SyntaxError: from __future__ imports must occur at the begin

SourceForge.net noreply at sourceforge.net
Mon Jul 23 07:29:07 EDT 2007


Bugs item #1758822, was opened at 2007-07-23 11:21
Message generated for change (Comment added) made by torstenphilipp
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=559966&aid=1758822&group_id=80503

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: lookup
Group: None
Status: Open
>Resolution: Works For Me
Priority: 5
Private: No
Submitted By: torsten (torstenphilipp)
Assigned to: Nathan R. Yergler (nyergler)
Summary: SyntaxError: from __future__ imports must occur at the begin

Initial Comment:
When I try to run the lookup.py I get the Error SyntaxError: from __future__ imports must occur at the beginning of the file
It looks like this in my terminal:

torsten at torsten-desktop:~$ /home/torsten/Desktop/MUSIC/cclookup-2.0-rc1/lookup.py
Traceback (most recent call last):
  File "/home/torsten/Desktop/MUSIC/cclookup-2.0-rc1/lookup.py", line 20, in <module>
    from cctagutils.metadata import metadata
  File "/home/torsten/Desktop/MUSIC/cclookup-2.0-rc1/cctagutils/__init__.py", line 5, in <module>
    import rdf
  File "/home/torsten/Desktop/MUSIC/cclookup-2.0-rc1/cctagutils/rdf.py", line 14, in <module>
    from cctagutils.metadata import metadata
  File "/home/torsten/Desktop/MUSIC/cclookup-2.0-rc1/cctagutils/metadata.py", line 18, in <module>
    from xmp import XmpMetadata
  File "/home/torsten/Desktop/MUSIC/cclookup-2.0-rc1/cctagutils/xmp.py", line 2, in <module>
    import ccrdf
  File "/home/torsten/Desktop/MUSIC/cclookup-2.0-rc1/ccrdf/__init__.py", line 4, in <module>
    import rdfextract
  File "/home/torsten/Desktop/MUSIC/cclookup-2.0-rc1/ccrdf/rdfextract.py", line 22, in <module>
    import rdfdict
  File "/home/torsten/Desktop/MUSIC/cclookup-2.0-rc1/ccrdf/rdfdict.py", line 18
    from __future__ import generators
SyntaxError: from __future__ imports must occur at the beginning of the file

----------------------------------------------------------------------

>Comment By: torsten (torstenphilipp)
Date: 2007-07-23 11:29

Message:
Logged In: YES 
user_id=1816353
Originator: YES

I managed to fix this (at least I think so) by moving the lines 16 and 17
in rdfdict.py upwards to lines 11 and 12, so that the beginning of the file
looks now like this 

"""
rdfdict.py

A generic wrapper for RDFlib which provides a dictionary-like interface
to
blocks of RDF with common subjects.  Also provides a utility wrapper,
rdfStore, for parsing and generating RDF.

(c) 2003-2004, Nathan R. Yergler
Licensed under the GNU GPL2
"""
# enable generators
from __future__ import generators

__id__ = "$Id: rdfdict.py 5208 2007-02-07 17:28:07Z nyergler $"
__version__ = "$Revision: 5208 $"
__copyright__ = '(c) 2003-2004, Nathan R. Yergler'
__license__ = 'licensed under the GNU GPL2'


# import some basic support structure
import sys
import xml.sax.xmlreader
import cStringIO
import sets


........... (and so on)

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=559966&aid=1758822&group_id=80503


More information about the cc-devel mailing list