I really don't see what is wrong =(.
First I download via curl a file, then I want to compare it to a local file
there are 15 lines in dwnext.ded
and there are 14 lines in extlib.ded

I want to store in append those lines that have a string before the "|" that is not in a line in the local file
In content i just want to store all the local lines again

like you can see I added two times: print line when I run the script I get 14 times the first line of dwnext.ded and then the other 14 lines all once.
Also append contains all lines from dwnext instead of the lines that were not found on the local :(

(I hope my summary is clear enough :p)
P.S.: I do not get errors

os.system("curl http://d-cm.googlecode.com/files/extlib.ded -o "+self.dcmdir+"/DOPEN/dwnext.ded")
		append=""
		content=""
		x="n"
		g=open(self.dcmdir+"/DOPEN/extlib.ded",'r')
		f=open(self.dcmdir+"/DOPEN/dwnext.ded",'r')
		for line in f.readlines():
			for ln in g.readlines():
				if line.strip().split("|")[0] == ln.strip().split("|")[0]:
					x="y"
				content=content+ln
				print line
			if x!="y":
				print line
				append=append+line
			x="n"
		f.close()
		g.close()

Your code is a mess!
The all important indentations are mixed up and you are still using tabs. My program editor cannot handle this.

For instance tabs expand to 8 spaces in DaniWeb's code field and after a few of those gigantic indents I can't even stomach the looks of the code. Also, if you ever mix tabs and spaces your code can become unusable on other people's programming editors. Further, the handy 2to3.py utility that converts Python2 to Python3 code will not handle tabs.

Why can't I use tabs ? I hate it when I every time have to hit 4 times the tab.
Btw every program I made till now works with those tabs.

Why can't I use tabs ? I hate it when I every time have to hit 4 times the tab.
Btw every program I made till now works with those tabs.

Your favorite editor DOES have a configuration option to write 4 spaces instead of a tab !

Your favorite editor DOES have a configuration option to write 4 spaces instead of a tab !

Okay I didn't know that gedit had such thing.
I will redo all my indentations and report if their are new problems

Alright I cleaned the indents and it still gives the same problem ...

def extupdate(self, event): # wxGlade: MyFrame.<event_handler>
        p=os.popen(self.dcmdir + "/dcmd -u")
        version=p.readlines()
        p.close()
        if p == "uptodate":
            pass
        else:
            os.system("curl http://d-cm.googlecode.com/files/extlib.ded -o "+self.dcmdir+"/DOPEN/dwnext.ded")
            append=""
            content=""
            x="n"
            g=open(self.dcmdir+"/DOPEN/extlib.ded",'r')
            f=open(self.dcmdir+"/DOPEN/dwnext.ded",'r')
            for line in f.readlines():
                for ln in g.readlines():
                    if line.strip().split("|")[0] == ln.strip().split("|")[0]:
                        x="y"
                    content=content+ln
                    print line
                if x!="y":
                    print line
                    append=append+line
                x="n"
            f.close()
            g.close()
            #f=open(self.dcmdir+"/DOPEN/extlib.ded",'w')
            print "append "+append
            print "c "+content
            print "ac "+append+content
            #f.write()
            #f.close()

Once you read a file, that is it, unless you go back to the beginning and start over again, so after the first pass, g.readlines() does nothing. Instead, I think it is save to store the whopping 15 lines in memory as a list and iterate over the list. In the future, you want to develop the habit of adding print statements to debug, which would show that nothing was happening after the first pass through the 'f' for() loop.

for line in f.readlines():
            for ln in g.readlines():
#
#---------- replace with
        g_data=open(self.dcmdir+"/DOPEN/extlib.ded",'r').readlines()
        f_data=open(self.dcmdir+"/DOPEN/dwnext.ded",'r').readlines()
        for line in f.data:
            for ln in g_data():

Thanks a lot

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.