Beat_Slayer 17 Posting Pro in Training

Come on guys you are arsh with each others.

I said that as info vegaseat, nothing more.

I said that because he had made like that and succeded, so he already have done mantining proportions, I said that so it was easier for him to see that this is without.

I don't understand, why the people here is so difficult with each others, I really like this forum, but i think that the people should keep their minds on sharing knowledge and trying to help.

And I'm not arguing against you vegaseat, I hope you understand me.

I'm just a coder wanting to share some knowledge, and to learn a lot with the great coders that go on this forums.

Happy coding!!!

EDIT: And sorry it this is off-topic or something like that.

Beat_Slayer 17 Posting Pro in Training

That won't keep proportions.

Beat_Slayer 17 Posting Pro in Training

You can if you calculate the factor of the resize, and use it to calculate the other dimension.

I think thats the only solution.

Beat_Slayer 17 Posting Pro in Training

I also thought of that, but that's what he asks.

Beat_Slayer 17 Posting Pro in Training

About the cycle.

countries = open('languages/country.lang', 'r').readlines()
for i in range (0, len(countries):
    vars()['A%s' % i + 1] = countries[i]
Beat_Slayer 17 Posting Pro in Training

Because of this line:

bin=2

it should be something like:

bin_n = bin(2)
r = bin_n ** n_input
Beat_Slayer 17 Posting Pro in Training

And something like:

newdata = data.replace("\\r\\n", "")
Beat_Slayer 17 Posting Pro in Training

I don't know much about OOP. But shouldn't it be like that.

And about the replace, can you post the error message???

import csv

class MyDialect(csv.excel): 
    self.lineterminator = "\n"  #  here
csv.register_dialect("myDialect", MyDialect) 

cr = csv.reader(open("data.csv","rb"), dialect = "myDialect")
cw = csv.writer(open("clean_data.csv", "wb"))
crlf = '\r\n'
for row in cr:
    for col in row:
        if crlf in col:
            #col.replace("\r\n", "") <-- didn't work
            col = col.rstrip()
    cw.writerow(row)
    
print "Finished"
Beat_Slayer 17 Posting Pro in Training

and wheres the code of that part where you type a folder name to see it's contents.

Beat_Slayer 17 Posting Pro in Training

Extracting the number at the end of a data string is fairly simple ...

data = """\
No of records Date Status
1 7/7/2010 Progress
Total Number of records Processed so far: 1012
Currently active records: 1"""

# split into a list of words and take the final element
active_records = data.split()[-1]
print(active_records)  # 1

Nice, looks like I wasn't lazy enough.

Nice line Vegas.

Beat_Slayer 17 Posting Pro in Training

Lazy simple mode.

f_in = open('output.txt').readlines()

for line in f_in:
    if 'Currently active records' in line:
        _, _, _, active_records = line.split(' ')
        print active_records
Beat_Slayer 17 Posting Pro in Training

list of int

list3 = [[int(x) for x in y] for y in list2]
Beat_Slayer 17 Posting Pro in Training

Here it is.

popdata2 = [x if x > 0.05 else 0 for x in popdata1]
print(popdata2)
Beat_Slayer 17 Posting Pro in Training

You are not saving them, I think you are aware of it, but maybe not, so...

for i in range(int(P)):
    for j in range(int(A)):
        popdata[i][j] = float(popdata[i][j])

Like this youre list stays altered in the end.

Beat_Slayer 17 Posting Pro in Training

Try this. You had unneeded brackets.

for i in range(int(P)):
    for j in range(int(A)):
        float(popdata[i][j])
Beat_Slayer 17 Posting Pro in Training

He is usinf the mobile facebook address because it asks less information to login, like authentication token and api key.

Beat_Slayer 17 Posting Pro in Training

I really don't get what you trying to do. It seems some esay thing with the data of some file. But I just don't get what.

Sum of numbers, ordering of the numbers, listing the average of the numbers, just listing the numbers...

I really don't know what.

And the CAPS are not needed, I believe the most of the people here is able to read your posts without them.

Beat_Slayer 17 Posting Pro in Training

I have in the past bitter experience of how compatible output the CSV are and wrote my own CSV module in Delphi, so I do think that for more complicated things CSV module must be great (dialects are not there without reason, I can tell you). I only do not know it so well yet, and I like to hold whole program in my mind. I have not used in my own code namedtuple, so thought it good opportunity to learn how to put it in use and same time maybe help somebody else.

P.S. Have a look at collections source code: the code for namedtuple is fine example how expressive Python is. My namedtuple version looks like candidate for code snippet, for me, what do you think?

I was seeing the collections little time ago, I used the deque on other project.

And yes, just post it, I liked it, pretty good.

Beat_Slayer 17 Posting Pro in Training

I thought the same Tony was just starting doing a namedtuple version. Luckly i stoped by to edit my post.

For the csv module I still use because I thought maybe for some csv may have some type of encoding.

Beat_Slayer 17 Posting Pro in Training

Hope it helps.

import csv

d={}

for row in csv.reader(open('sample.dat')):
    d['ID %s' % row[0]] = {'name': row[1], 'email': row[2], 'homeaddress': row[3]}

print d
print

user_id = 125

print 'ID %s:' % user_id, d['ID %s' % user_id]
print
print 'ID %s' % user_id
print 'Name:', d['ID %s' % user_id]['name'],
print 'Email:', d['ID %s' % user_id]['email'],
print 'Home Address:', d['ID %s' % user_id]['homeaddress']

Output:

>>> 
{'ID 126': {'homeaddress': ' 459 happy st.', 'name': ' gishi4', 'email': ' gishi4@mymail.com'}, 'ID 124': {'homeaddress': ' 457 happy st.', 'name': ' gishi2', 'email': ' gishi2@mymail.com'}, 'ID 125': {'homeaddress': ' 458 happy st.', 'name': ' gishi3', 'email': ' gishi3@mymail.com'}, 'ID 123': {'homeaddress': ' 456 happy st.', 'name': ' gishi', 'email': ' gishi@mymail.com'}}

ID 125: {'homeaddress': ' 458 happy st.', 'name': ' gishi3', 'email': ' gishi3@mymail.com'}

ID 125
Name:  gishi3 Email:  gishi3@mymail.com Home Address:  458 happy st.
Beat_Slayer 17 Posting Pro in Training

If the fields are in the same position you can tweak a little the read function and add the fields.

Can you post a sample csv?

Beat_Slayer 17 Posting Pro in Training

Can't you do like this:

d['key']['fieldname']
Beat_Slayer 17 Posting Pro in Training

I was talking about the datetime code Tony.

When I started writing you didn't had edited your post yet.

Beat_Slayer 17 Posting Pro in Training

A simple example. It's only a example, not a finnished code, but you can try to add to the concept of Tony and we'll see where you get. ;)

f_backup = path_to_file
basename, ext = os.splitext(f_backup)
copy_path = path_to_copy

counter =0
while running:

    if copied == None and os.path.isfile(f_backup) == 1:
        counter += 1
        os.copy(f_backup, copy_path + basename + counter + ext)
        os.remove(f_backup)
        copied = True

    if copied == True and os.path.isfile(f_backup) == 1:
        os.remove(f_backup)
        copied = None
Beat_Slayer 17 Posting Pro in Training

Your code will only run on linux. It looks more like a bash script then a python code.

I just don't get if they are multiple files to copy and if it is to copy every day
or id it only 15 of all the backups that there exist.

Beat_Slayer 17 Posting Pro in Training

If I understood.

extensions = ['.txt', '.jpg', '.zip']

f_name, f_extension = os.path.splitext(filename)

for extension in extensions:
    if f_extension == extension:
        do_something()
Beat_Slayer 17 Posting Pro in Training

No need to sorry about that.

We all have doubts, and can get confused sometimes.

I was reading that yesterday, thats why it came so fast to me. :)

You can mark as solved.

lol

Happy coding.

Beat_Slayer 17 Posting Pro in Training

I might be wrong, but I believe with may be talking about this.

If it is, you are a litle bit confused, since point is not a data structure, the namedtuple is the data structure you are searching for.

congrats

Beat_Slayer 17 Posting Pro in Training

You need a diferent aproach because the login page it's on php with a javascript login.

Beat_Slayer 17 Posting Pro in Training

The intention was to give negative condition on the lines with 'DTP', and not to give positive.

Anyway a litle more refreshed.

f_in = open('input.txt', 'r')
f_out = open('output.txt', 'w')

for line in f_in:
    if 'DTP' not in line:
        f_out.write(line)
    else:
        f_out.write(line.replace('DTP', 'NEW_WORD'))

f_in.close()
f_out.close()
Beat_Slayer 17 Posting Pro in Training

Something like:

f_in = open('input.txt', 'r')
f_out = open('output.txt', 'w')

for line in f_in:
    if line.find('DTP') == 0:
        f_out.write(line)

or

f_in = open('input.txt', 'r')
f_out = open('output.txt', 'w')

for line in f_in:
    line.replace('DTP', 'NEW_WORD')
    f_out.write(line)

Sorry for the lazyness, but I'm not at home.

Beat_Slayer 17 Posting Pro in Training
def unrar():

    try:
        os.chdir(fileDir)
        
        print "\n-------------"
        print "Installing..."
        print "-------------\n"

        found = None
        archive = Unrar2.RarFile(filename)	
        
        for file_archive in Unrar2.RarFile(filename).infoiter():

            file = os.path.split(file_archive.filename)[-1]			

	    basename, ext = os.path.splitext(file)
			
            if ext == ".package":
                print "Found %s. Extracting to \\Packages." % file
                archive.extract(file_archive, modDir + "\\Packages", False)
                found == True
				
            elif ext == ".dbc":
                print "Found %s. Extracting to \\DCCache." % file
                archive.extract(file_archive, modDir + "\\DCCache", False)
                found == True
				
        if found:
            print "\nInstallation successful!"
	    os.system("pause")
        else:
            print "No valid files found."
            os.system("pause")
            os.system("cls")
            checkExtension()
Beat_Slayer 17 Posting Pro in Training

Sorry but this is my last try for today, I'm too tired.

Try like this, otherwise tomorrow I'll download the package and try it.

def unrar():

    try:
        os.chdir(fileDir)
        
        print "\n-------------"
        print "Installing..."
        print "-------------\n"

        found = None
        archive = Unrar2.RarFile(filename)	
        
        for file_archive in Unrar2.RarFile(filename).infoiter():

            file = os.path.split(file_archive.filename)[-1]			

	    basename, ext = os.path.splitext(file)
			
            if ext == ".package":
                print "Found %s. Extracting to \\Packages." % file
                archive.extract(file, modDir + "\\Packages", False)
                found == True
				
            elif ext == ".dbc":
                print "Found %s. Extracting to \\DCCache." % file
                archive.extract(file, modDir + "\\DCCache", False)
                found == True
				
        if found:
            print "\nInstallation successful!"
	    os.system("pause")
        else:
            print "No valid files found."
            os.system("pause")
            os.system("cls")
            checkExtension()
Beat_Slayer 17 Posting Pro in Training

I'm sorry but I can't test it where I am now, and I'm a litle sleepy. :)

But I think now I got it.

def unrar():

    try:
        os.chdir(fileDir)
        
        print "\n-------------"
        print "Installing..."
        print "-------------\n"

        found = None
        archive = Unrar2.RarFile(filename)	
        
        for file_archive in archive.infoiter():

            file = os.path.split(file_archive.filename)[-1]			

	    basename, ext = os.path.splitext(file)
			
            if ext == ".package":
                print "Found %s. Extracting to \\Packages." % file
                archive.extract(file, modDir + "\\Packages", False)
                found == True
				
            elif ext == ".dbc":
                print "Found %s. Extracting to \\DCCache." % file
                archive.extract(file, modDir + "\\DCCache", False)
                found == True
				
        if found:
            print "\nInstallation successful!"
	    os.system("pause")
        else:
            print "No valid files found."
            os.system("pause")
            os.system("cls")
            checkExtension()
Beat_Slayer 17 Posting Pro in Training

Oups... :)

I was sleeping.

def unrar():

    try:
        os.chdir(fileDir)
        
        print "\n-------------"
        print "Installing..."
        print "-------------\n"

        found = None
		
        for file in Unrar2.RarFile(filename).infoiter():
			
	    basename, ext = os.path.splitext(file)
			
            if ext == ".package":
                print "Found %s. Extracting to \\Packages." % file
                archive.extract(file, modDir + "\\Packages", False)
                found == True
				
            elif ext == ".dbc":
                print "Found %s. Extracting to \\DCCache." % file
                archive.extract(file, modDir + "\\DCCache", False)
                found == True
				
        if found:
            print "\nInstallation successful!"
	    os.system("pause")
        else:
            print "No valid files found."
            os.system("pause")
            os.system("cls")
            checkExtension()
Beat_Slayer 17 Posting Pro in Training
def unrar():

    try:
        os.chdir(fileDir)
        
        print "\n-------------"
        print "Installing..."
        print "-------------\n"

        found = None
		
        for filename in Unrar2.RarFile(filename).infoiter():
			
	    basename, ext = os.path.splitext(filename)
			
            if ext == ".package":
                print "Found %s. Extracting to \\Packages." % filename
                archive.extract(filename, modDir + "\\Packages", False)
                found == True
				
            elif ext == ".dbc":
                print "Found %s. Extracting to \\DCCache." % filename
                archive.extract(filename, modDir + "\\DCCache", False)
                found == True
				
        if found:
            print "\nInstallation successful!"
	    os.system("pause")
        else:
            print "No valid files found."
            os.system("pause")
            os.system("cls")
            checkExtension()
Beat_Slayer 17 Posting Pro in Training

What's the OS you are coding on?

And how about this.

if name.find(".package") != -1:
                print "Found %s. Extracting to \\Packages." % name
                archive.extract(name, modDir + "\\Packages", False)
                found = True

Edit:

class RarInfo(__builtin__.object)
Represents a file header in an archive. Don't instantiate directly.
Use only to obtain information about file.
YOU CANNOT EXTRACT FILE CONTENTS USING THIS OBJECT.
USE METHODS OF RarFile CLASS INSTEAD.

So....

class RarFile

__del__(self)

__init__(self, archiveName, password=None)
    Instantiate the archive.
     
    archiveName is the name of the RAR file.
    password is used to decrypt the files in the archive.
     
    Properties:
        comment - comment associated with the archive
     
    >>> print RarFile('test.rar').comment
    This is a test.

extract(self, condition='*', path='.', withSubpath=True)
    Extract specific files from archive to disk.
     
    If "condition" is a list of numbers, then extract files which have those positions in infolist.
    If "condition" is a string, then it is treated as a wildcard for names of files to extract.
    If "condition" is a function, it is treated as a callback function, which accepts a RarInfo object
        and returns either boolean True (extract) or boolean False (skip).
    DEPRECATED: If "condition" callback returns string (only supported for Windows) - 
        that string will be used as a new name to save the file under.
    If "condition" is omitted, all files are extracted.
     
    "path" is a directory to extract to
    "withSubpath" flag denotes whether files are extracted with their full path in the archive.
     
    Returns list of RarInfos for extracted files. …
Beat_Slayer 17 Posting Pro in Training

Tony I believe they are path directories names, but if it is so they should be doubled.

Something like this:

if name.find(".package") != -1:
                print "Found %s. Extracting to \\Packages." % name
                archive.extract(name, modDir + "\\Packages")
                found = True
Beat_Slayer 17 Posting Pro in Training

I'm not an expert on regex, but you can I think the regex is still right.

Maybe the constituion of the html has changed.

Beat_Slayer 17 Posting Pro in Training

If you replace the read from the url with the html code you gave, it works just fine.

Could it be something related to the talking with the server?

We can test it.

matchstr = urlopen('http://192.168.0.1/stlui/user/allowance_request.html%20target=%22allowance%22').read()
matchstr = '''
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
<meta http-equiv="refresh" Content="60;url=/stlui/user/allowance_request.html">
<title>Download Allowance Status</title></head><body><h3 style="font-size: 150%; color:blue; text-align:center; font-weight:bold">DOWNLOAD ALLOWANCE STATUS</h3><TABLE width='100%' cellpadding='10'><tr><td style="text-align:center;"><h3>Usage within allowance - no download restrictions</h3></td><td><span style="display:block;text-align:center">100%</span><table style="font-size:1; background-color:white; border:1px solid black;" width='15%' cellspacing='0' cellpadding='0' align='center'><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr><tr style="background-color:green"><td>&nbsp;</td></tr></table><span style="display:block;text-align:center">0%</span></td></tr><tr><td>&nbsp;</td><td><table style="font-size:18; border-width:0px;" width=90% cellspacing=0 cellpadding=0 ALIGN=CENTER><tr><td>&nbsp;</td><td style="border-width:0px;">Plan Allowance (MB)</td><td style="border-width:0px;"> 625</td></tr><tr><td>&nbsp;</td><td style="border-width:0px;">Allowance Remaining (MB)</td><td style="border-width:0px;"> 625</td></tr><tr><td><span style="background-color: green;">&nbsp;&nbsp;&nbsp;</span>&nbsp;</td><td style="border-width:0px;">Allowance Remaining (%)</td><td style="border-width:0px;"> 100</td></tr><tr><td>&nbsp;</td><td style="border-width:0px;">Time Until Allowance Refill</td><td style="border-width:0px;"> 22:18:01</td></tr></table></td></tr></TABLE>
</body>
</html>
'''
Beat_Slayer 17 Posting Pro in Training

I don't get your question and, what you really want to do.

If it is what I think you can just check if the name of the current customer is the name of the winner and display the message.

But fot it to be logic, you ahould be saving all those values in file, and showing the message the next time the customer would log.

Beat_Slayer 17 Posting Pro in Training

test_UnRAR2.py

If you take a look at this, it will get easier.

I can tested but i think something likethis maybe. :)

for rarinfo in archive.infoiter():
    if rarinfo.filename == "*.txt":
        # your code
Beat_Slayer 17 Posting Pro in Training
f_input = open('input.txt', 'r')
f_output = open('output.txt', 'w')

for currentline in f_input:
    newline = currentline.replace(' ', '')
    f_output.write(newline)

f_input.close()
f_output.close()
Beat_Slayer 17 Posting Pro in Training

How about some crossing between the two scripts. ;)

Cumps.

import appuifw
import e32
import inbox
import logs

def Quit():
    app_lock.signal()

def message_received(msg_id):
	box = inbox.Inbox()
	sms_text = box.content(msg_id)
	sender = box.address(msg_id)
        sender_number = sms_log_in[0]['number']

#To handle received messages.	
box = inbox.Inbox()
box.bind(message_received)

#To catch last number by the logs last received message
sms_log_in = logs.sms(mode='in')

#To handle Exit
appuifw.app.exit_key_handler = Quit
app_lock = e32.Ao_lock()
app_lock.wait()
Beat_Slayer 17 Posting Pro in Training

Hi, you don't need all those imports.

You get the correct number that actually sent you the sms with your code.

About mine code, it runs smoothly here.

import appuifw
import e32
import inbox

def Quit():
    app_lock.signal()

def message_received(msg_id):
	box = inbox.Inbox()
	sms_text = box.content(msg_id)
	sender = box.address(msg_id)

#To handle received messages.	
box = inbox.Inbox()
box.bind(message_received)

#To handle Exit
appuifw.app.exit_key_handler = Quit
app_lock = e32.Ao_lock()
app_lock.wait()
Beat_Slayer 17 Posting Pro in Training

Can you post some code to make it more clear.

From my experience the sendernumber given by line 18 is the number that sent you the sms. If you reply to that number the sms will go to who sent you.

But if you pick the sendername pick by line 20 then you can have thosekind of problems.

I want to help.

Beat_Slayer 17 Posting Pro in Training

Here's a test script I've written some time ago. Hope it helps.

And to all the experts, I'm just beginning python and symbian, don't be to arsh on me. :D

import appuifw
import audio
import contacts
import e32 
import inbox
import time

appuifw.app.title = u"->>SMSTalk v1"
appuifw.note(u"Loading ->>SMSTalk v1 by Beat_Slayer...", 'info')
print "\nLoading ->>SMSTalk v1 by Beat_Slayer..."

def now():
    t = time.time()
    hh, mm, ss = time.localtime(t)[3:6] 
    return (str(hh) + "h:" + str(mm) + "m:" + str(ss)) + "s"

def readsms(index):
    sendernumber = inbox.address(index)
    sender = list.find(sendernumber)
    name = sender[0].title
    smstime = inbox.time(index)
    content = inbox.content(index)
    readit = appuifw.query(u"SMS from " + name + ". Read it?", 'query')
    if readit == True:
        audio.say(content)
        print "\n->>SMSTalk read a message from " + name + " at " + now() + "."
    else:
        print "\n->>SMSTalk ignored a message from " + name + " at " + now() + "."


def exit_key_handler():
    appuifw.note(u"->>SMSTalk v1 successfull!",'conf')
    print "\n->>SMSTalk v1 successfull!"
    print "Beat_Slayer 2010"
    lock.signal()

lock = e32.Ao_lock() 
inbox = inbox.Inbox() 
list = contacts.open()
print "\n->>SMSTalk v1 waiting for incoming SMS..."
inbox.bind(readsms)

appuifw.app.exit_key_handler = exit_key_handler
lock.wait()
Beat_Slayer 17 Posting Pro in Training

Symbian module description

You can check there and come with some code questions. ;)

I also program on that platform. Cheers! ;)

Again... lol

Beat_Slayer 17 Posting Pro in Training

I think this should do it.

output.write('%s, %s\n' % (evidence_array[y], found[y])