Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 238075
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T20:28:36+00:00 2026-05-11T20:28:36+00:00

I am trying to use set function in App Engine, to prepare a list

  • 0

I am trying to use set function in App Engine, to prepare a list with unique elements. I hit a snag when i wrote a Python code which works fine in the Python Shell but not in App Engine + Django

This is what i intend to do(ran this script in IDLE):

import re
value='   r.dushaynth@gmail.com, dash@ben,,  , abc@ac.com.edu    '
value = value.lower()
value = list(set(re.split('^\s*|\s*,+\s*|\s*$', value)))
if (value[0] == ''):
    value.remove('')
print value       

The desired output is(got this output in IDLE):

['dash@ben', 'abc@ac.com.edu', 'r.dushaynth@gmail.com']

Now when I do something equivalent in my views.py file in App Engine:

import os
import re
import django
from django.http import HttpResponse
from django.shortcuts import render_to_response # host of other imports also there
def add(request):

    value='   r.dushaynth@gmail.com, dash@ben,,  , abc@ac.com.edu    '
    value = value.lower()
    value = list(set(re.split('^\s*|\s*,+\s*|\s*$', value)))
    if (value[0] == ''):
        value.remove('')


    return render_to_response('sc-actonform.html', {
        'value': value,
    })

I get this error while going to the appropriate page(pasting the traceback):

Traceback (most recent call last):
File "G:\Dhushyanth\Google\google_appengine\lib\django\django\core\handlers\base.py" in get_response
  77. response = callback(request, *callback_args, **callback_kwargs)
File "G:\Dhushyanth\development\AppengineProjects\trunk_sanjhachoolha\sandbox\dushyanth\sanjhachoolha\views.py" in add
  148. value = list(set(re.split('^\s*|\s*,+\s*|\s*$', value)))
File "G:\Dhushyanth\development\AppengineProjects\trunk_sanjhachoolha\sandbox\dushyanth\sanjhachoolha\views.py" in list
  208. return respond(request, None, 'sc-base', {'content': responseText})
File "G:\Dhushyanth\development\AppengineProjects\trunk_sanjhachoolha\sandbox\dushyanth\sanjhachoolha\views.py" in respond
  115. params['sign_in'] = users.create_login_url(request.path)

  AttributeError at /sanjhachoolha/acton/add
  'set' object has no attribute 'path'

on commenting out:

#value = list(set(re.split('^\s*|\s*,+\s*|\s*$', value)))

I get the desired output in the appropriate webpage:

r.dushaynth@gmail.com, dash@ben,, , abc@ac.com.edu

I am sure the list() is the root of my troubles. Can anyone suggest why this is happening. Please also suggest alternatives. The aim is to remove duplicates from the list.

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T20:28:36+00:00Added an answer on May 11, 2026 at 8:28 pm

    It seems like you implemented your own list() function. Its return statements should be at line 208 of your file (views.py). You should rename your list() function to something else (even list_()).

    EDIT: Also you can change you regexp, like this:

    import re
    value='   r.dushaynth@gmail.com, dash@ben,,  , abc@ac.com.edu    '
    value = value.lower()
    
    #value = list(set(re.split('^\s*|\s*,+\s*|\s*$', value)))
    #if (value[0] == ''):
    #    value.remove('')
    
    value = set(re.findall(r'[\w\d\.\-_]+@[\w\d\.\-_]+', value))
    
    print value
    

    re.findall() returns a list of all matched occurences.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 122k
  • Answers 122k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer This really deserves something more than "Should you walk before… May 12, 2026 at 12:46 am
  • Editorial Team
    Editorial Team added an answer You need to use PInvoke to register hot keys. Here… May 12, 2026 at 12:46 am
  • Editorial Team
    Editorial Team added an answer I would recommend using a reset stylesheet (or insert reset… May 12, 2026 at 12:46 am

Related Questions

originally i was using easyPHP (windows) then i switch to mac and used MAMP.
How can I efficiently catch and handle segmentation faults from C in an OSX
I have the following vbscript code that returns the local IP address. It works
Note: A possible solution needs only work in Firefox 3.0, my app doesn't allow

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.