Question

When i start my django server and type some url django always give me an EOL error:

SyntaxError at /accounting/payments/
    EOL while scanning string literal (urls.py, line 22)
    Request Method: GET
    Request URL:    http://localhost:8000/accounting/payments/
    Django Version: 1.4
    Exception Type: SyntaxError
    Exception Value:    
    EOL while scanning string literal (urls.py, line 22)
    Exception Location: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/utils/importlib.py in import_module, line 35
    Python Executable:  /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
    Python Version: 2.7.3
    Python Path:    
    ['/Users/Tone/Documents/Proyectos/macrogest/MacroTelecom',
     '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/distribute-0.6.27-py2.7.egg',
     '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/South-0.7.5-py2.7.egg',
     '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django_debug_toolbar-0.8.5-py2.7.egg',
     '/Library/Python/2.7/site-packages/MySQL_python-1.2.3-py2.7-macosx-10.7-intel.egg',
     '/Library/Python/2.7/site-packages/ipython-0.13-py2.7.egg',
     '/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip',
     '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
     '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
     '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
     '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
     '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',
     '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old',
     '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload',
     '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages',
     '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PIL',
     '/Users/Tone/Documents/django/django',
     '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg-info',
     '/Library/Python/2.7/site-packages',
     '/Users/Tone/Documents/Django']

And this is my urls.py code:

from django.conf.urls.defaults import patterns, include, url

# Uncomment the next two lines to enable the admin:
#from django.contrib import admin
#admin.autodiscover()

urlpatterns = patterns('',

    # Site control
    url(r'^$', 'macrotelecom.base.views.home', name='home'),
    url(r'^company/', include('macrotelecom.company.urls')),
    url(r'^people/', include('macrotelecom.people.urls')),
    url(r'^lines/', include('macrotelecom.lines.urls')),
    url(r'^accounting/', include('macrotelecom.accounting.urls')),
    url(r'^sales/', include('macrotelecom.sales.urls')),
    url(r'^shop/', include('macrotelecom.shop.urls')),
    url(r'^news/', include('macrotelecom.news.urls')),
    url(r'^map/', 'macrotelecom.base.views.webmap', name='map'),
    url(r'^error/$', 'macrotelecom.base.views.error', name='error'),

    # Internal
    url(r'^favicon\.ico$', 'django.views.generic.simple.redirect_to', {'url': '/static/img/favicon.ico'}),
    url(r'^i18n/', include('django.conf.urls.i18n')),
    #url(r'^admin/', include(admin.site.urls)),
    url(r'^rosetta/', include('rosetta.urls')),

    # User control
    (r'^not_authorized/$', 'base.views.not_authorized'),
    (r'^login/$', 'django.contrib.auth.views.login'),
    (r'^logout/$', 'django.contrib.auth.views.logout'),
    (r'^password_change/$','django.contrib.auth.views.password_change'),
    (r'^password_change/done/$','django.contrib.auth.views.password_change_done'),
    (r'^password_reset/$','django.contrib.auth.views.password_reset'),
    (r'^password_reset/done/$','django.contrib.auth.views.password_reset_done'),
    (r'^reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$','django.contrib.auth.views.password_reset_confirm'),
    (r'^reset/done/$','django.contrib.auth.views.password_reset_complete'),

)

Line 22 correspond with the favicon url, i thought that could be the scape character or something like that (i put an # for comment) but didn't work, always says EOL error, what could it be?

Was it helpful?

Solution

That file (at least the part you posted) does not have any syntax errors. Sometimes errors can appear to come from a different files.

Check the files you've recently edited by just running the interpreter on them, python myapp/views.py or so. If you get NameError or ImportError, or it just runs fine, then there are no syntax errors in myapp/views.py, so try another file.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top