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 747959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T14:15:54+00:00 2026-05-14T14:15:54+00:00

I have the following code in one of my classes along with checks when

  • 0

I have the following code in one of my classes along with checks when the code does not eval:

filterParam="self.recipientMSISDN==tmpBPSS.split('_')[3].split('#')[0] and   self.recipientIMSI==tmpBPSS.split('_')[3].split('#')[1]" 
if eval(filterParam):
   print "Evalled"
else:
   print "Not Evalled\nfilterParam\n'%s'\ntmpBPSS\n'%s'\nself.recipientMSISDN\n'%s'\nself.recipientIMSI\n'%s'" % (filterParam, tmpBPSS, self.recipientMSISDN, self.recipientIMSI)

I am not getting anything to ‘eval’. Here are the results:

Not Evalled
filterParam
'self.recipientMSISDN==tmpBPSS.split('_')[3].split('#')[0] and    self.recipientIMSI==tmpBPSS.split('_')[3].split('#')[1]'
tmpBPSS
'bprm_DAILY_MO_919844000039#892000000'
self.recipientMSISDN
'919844000039'
self.recipientIMSI
'892000000'

So I used the outputs from the above to check the code in a python shell and as you can see the code evalled correctly:

>>> filterParam="recipientMSISDN==tmpBPSS.split('_')[3].split('#')[0] and recipientIMSI==tmpBPSS.split('_')[3].split('#')[1]"
>>> tmpBPSS='bprm_DAILY_MO_919844000039#892000000'
>>> recipientMSISDN='919844000039'
>>> recipientIMSI='892000000'
>>> if eval(filterParam):
...    print "Evalled"
... else:
...    print "Not Evalled"
...
Evalled

Am I off my rocker or what am I missing?

A

  • 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-14T14:15:55+00:00Added an answer on May 14, 2026 at 2:15 pm

    Most likely, the type of self.recipientIMSI or self.recipientMSISDN is int, and comparing them with strings returns False. Add this line to see if this is the case:

    print type(self.recipientIMSI), type(self.recipientMSISDN)
    

    If not, try checking what the same expression evaluates to without eval.

    That said, Are you sure you need to use eval? Usually there’s a way of doing things without eval or exec, which will lead to safer, more maintainable code.

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

Sidebar

Related Questions

i have the following code part in one of my classes: $l = new
I have the following code in one of our projects webpages: XmlDocument xDoc =
Using linkedin-j , I have the following code in one part of my application
I have the following code snippet: enum { one } x; enum { two
In Scala IDE I have the following code: package pkg.one object S { class
I have the following code and everytime I click on one of the markers,
I have the following code which swaps out one divs innerHTML for the others
I have the following code which copies property values from one object to another
I have the following code which takes a touch on one button and draws
Let's say that I have the following code that's run in one thread of

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.