Re: Configure this group in email client
Try 62.181.3.13 (Global news server) Also, check this thread http://groups-beta.google.com/group/comp.lang.python/browse_frm/thread/df0f1bc9514bf353/3fe59b5daf26dc89?q=thunderbird#3fe59b5daf26dc89 -- http://mail.python.org/mailman/listinfo/python-list
wxPython Grid Cell change question
Hello All, I created a grid, where I register events every time the user changes an existing value inside the grid control. Right now, I am using the event: EVT_GRID_CELL_CHANGE. However, I realized that I need to register that same kind of event even if the user doesnt change the value, but just selects and then deselects. I tried creating my own custom event, where i check to see if the editor is activated and then deactivated, and if so, then set the sell value. However, this doesnt work because the value that it needs to be set to is the same previous value that was in the grid. Therefore, I can never get a new value in the grid. Here is the code for the events: in init(): self.Bind(wx.grid.EVT_GRID_EDITOR_SHOWN, self.EditorShown) self.Bind(wx.grid.EVT_GRID_EDITOR_HIDDEN, self.EditorHidden) def EditorShown(self, event): self.editorShown = True event.Skip() def EditorHidden(self, event): self.editorHidden = True row = event.GetRow() col = event.GetCol() print "VAL = " + str(self.grid.GetCellValue(row, col)) +str(self.OnTestCellValue(row, col)) event.Skip() def OnTestCellValue(self, row, col): if self.editorShown and self.editorHidden: self.editorShown = False self.editorHidden = False self.SetCellValue(row, col) def SetCellValue(self, row, col): print "EVENT PROCESSIGN STARTED" print "RAW VAL = " + str(self.grid.GetCellValue(row, col)) value = int(self.grid.GetCellValue(row, col), 16) print "VAL = " + str(value) # if we need to add a row if row == (len(self.data)-1): self.expandGrid() self.data.append([]) # if we need to delete a row if row != 0 and value == '': self.data[row][3] = 'Delete' else: self.addToData(row, col, value, True) # whether the user intended a read or write if self.data[row][3] != 'Delete': if col == 1: self.data[row][3] = 'Read' elif col == 2: self.data[row][3] = 'Write' q = copy.deepcopy(self.data) # cloning object self.requestQueue.put(q) # putting object onto queue print "EVENT PROCESSIGN ENDED" Thanks a lot for your help, and please mind the spacing. I should note that before, my bind was: self.Bind(wx.grid.EVT_GTID_CELL_CHANGE, self.SetCellValue) thanks, Kiran -- http://mail.python.org/mailman/listinfo/python-list
Re: wxPython Grid Cell change question
Never mind, I used 2 different binds for the 2 different situations and it worked. thanks for looking anyhow. -- Kiran Kiran wrote: > Hello All, > I created a grid, where I register events every time the user changes > an existing value inside the grid control. Right now, I am using the > event: EVT_GRID_CELL_CHANGE. However, I realized that I need to > register that same kind of event even if the user doesnt change the > value, but just selects and then deselects. > > I tried creating my own custom event, where i check to see if the > editor is activated and then deactivated, and if so, then set the sell > value. However, this doesnt work because the value that it needs to be > set to is the same previous value that was in the grid. Therefore, I > can never get a new value in the grid. Here is the code for the events: > > in init(): > self.Bind(wx.grid.EVT_GRID_EDITOR_SHOWN, self.EditorShown) > self.Bind(wx.grid.EVT_GRID_EDITOR_HIDDEN, self.EditorHidden) > > > def EditorShown(self, event): > self.editorShown = True > event.Skip() > > def EditorHidden(self, event): > self.editorHidden = True > row = event.GetRow() > col = event.GetCol() > print "VAL = " + str(self.grid.GetCellValue(row, col)) > +str(self.OnTestCellValue(row, col)) > event.Skip() > > def OnTestCellValue(self, row, col): > if self.editorShown and self.editorHidden: > self.editorShown = False > self.editorHidden = False > self.SetCellValue(row, col) > > def SetCellValue(self, row, col): > print "EVENT PROCESSIGN STARTED" > print "RAW VAL = " + str(self.grid.GetCellValue(row, col)) > value = int(self.grid.GetCellValue(row, col), 16) > print "VAL = " + str(value) > # if we need to add a row > if row == (len(self.data)-1): > self.expandGrid() > self.data.append([]) > # if we need to delete a row > if row != 0 and value == '': > self.data[row][3] = 'Delete' > else: > self.addToData(row, col, value, True) > # whether the user intended a read or write > if self.data[row][3] != 'Delete': > if col == 1: > self.data[row][3] = 'Read' > elif col == 2: > self.data[row][3] = 'Write' > > q = copy.deepcopy(self.data) # cloning object > self.requestQueue.put(q) # putting object onto queue > print "EVENT PROCESSIGN ENDED" > > Thanks a lot for your help, and please mind the spacing. > > I should note that before, my bind was: > self.Bind(wx.grid.EVT_GTID_CELL_CHANGE, self.SetCellValue) > > > thanks, > Kiran -- http://mail.python.org/mailman/listinfo/python-list
wxPython Grid XY Coordinates question
Hello All, I am writing an app in wxPython using a grid. I need to be able to recognize what cell in the grid the user is hovering over with the mouse. How to do this? I tried XYToCell(x, y), but that doesnt work properly because it thinks that mouse position (0, 0) is the first cell in the grid, and then goes from there, so if i move the grid to a differernt area on the screen, the XYToCell is messed up in what it returns. Any ideas on how to get this to work or any other way? thanks, Kiran -- http://mail.python.org/mailman/listinfo/python-list
2 timers, doesnt work?
I am creating 2 timers inside a GUI, but it seems that only the one declared last (the second timer), gets triggered, but the first one doesnt. Here is the code for the timers: # main timer, which governs when the register watcher get updated self.mainTimer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.UpdateAll, self.mainTimer) self.mainTimer.Start(5, False) # graph timer, which governs when the graph gets updated self.grphTimer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.upGrphDisplay, self.grphTimer) self.grphTimer.Start(101, False) So in this case, only the upGrphDisplay method gets called, the UpdateAll function doesnt get called. Any clues as to why this is happening? thanks a lot! -- kiran -- http://mail.python.org/mailman/listinfo/python-list
Re: wxPython Grid XY Coordinates question
Will, thank you. That was the right thing to do, and it worked -- Kiran Will McGugan wrote: > Kiran wrote: > > Hello All, > > I am writing an app in wxPython using a grid. I need to be able to > > recognize what cell in the grid the user is hovering over with the > > mouse. How to do this? > > I tried XYToCell(x, y), but that doesnt work properly because it > > thinks that mouse position (0, 0) is the first cell in the grid, and > > then goes from there, so if i move the grid to a differernt area on the > > screen, the XYToCell is messed up in what it returns. > > > > Any ideas on how to get this to work or any other way? > > > > XYToCell probably takes window (client) coordinates. If you have the > mouse position in screen coordinates, you will need to convert them with > the ScreenToClient for your grid. > > Will McGugan > -- > work: http://www.kelpiesoft.com > blog: http://www.willmcgugan.com -- http://mail.python.org/mailman/listinfo/python-list
wxPython Linux Compatibility question
Hello All, My question is regarding MDI Windows Support for Linux in wxPython. I am currently writing an application which uses MDI. I have seen that in linux, it basically makes all MDI windows tabs (without close, minimize, or maximize buttons and other tools such as cascade and stuff), which is fine by me. I however want to know which MDI window the user has focus of so that the user has an option of closing the window if they so desired under Linux. How would I find this out? thanks a lot! -- Kiran -- http://mail.python.org/mailman/listinfo/python-list
Re: 2 timers, doesnt work?
Makes sense Frank, and that seemed to work also, so thanks a lot! Frank Millman wrote: > Kiran wrote: > > I am creating 2 timers inside a GUI, but it seems that only the one > > declared last (the second timer), gets triggered, but the first one > > doesnt. > > > > You really should check the archives before posting. Exactly the same > question was asked less than a week ago. > > The original question was answered by Nikie. I have quoted the reply > verbatim - > > > The problem is not that the first timer is stopped, the problem is > that both timers happen to call the same method in the end. > > Think of the "Bind" method as an assignment: it assigns a handler > function to an event source. If you call it twice for the same event > source, the second call will overwrite the first event handler. That's > what happens in your code. > > > The easiest way to change this is by using different ids for the > timers: > > > def startTimer1(self): > self.t1 = wx.Timer(self, id=1) > self.t1.Start(2000) > self.Bind(wx.EVT_TIMER, self.OnUpTime, id=1) > > > def startTimer2(self): > self.t2 = wx.Timer(self, id=2) > self.t2.Start(1000) > self.Bind(wx.EVT_TIMER, self.OnTime, id=2) > > > This way, the timers launch two different events, which are bound to > two different methods. > > > I would suggest one minor change. Create a variable for the id using > wx.NewId(), and pass the variable as an argument in both places, > instead of hard-coding the id. That way you are guaranteed to get a > unique id. In a large project it can be difficult to keep track of > which id's have been used if they are all hard-coded. > > Frank Millman -- http://mail.python.org/mailman/listinfo/python-list
wxPython font color
hey everybody, i cant seem to find a way to create a font with a non-default color using the wx.Font constructor. anybody know how to change hte color? thanks -- http://mail.python.org/mailman/listinfo/python-list
return tuple from C to python (extending python)
Hi all, I want to make python call some C functions, process them and return them. Ok, I got all the wrapper functions and everything setup right. Here is my problem. What I need to do is to return a tuple from C to python. To go about doing this, I first create a tuple object in C doing the following: PyObject* toRet; toRet = PyTuple_New(num_addr); then, in a for loop, i assign values to the tuple as follows: for ( i = 0; i < num_addr; i++ ) { printf("%d\n", dat[i]); PyTuple_SET_ITEM(toRet, i, (PyObject*)dat[i] ); } (dat is declared as follows: unsigned int* dat; ) then, i say return toRet at the end of my C function. when I try to print the tuple in python, it says the memory address 0x could not be written, and I can see a part of the tuple printout, which is as follows: ( , then i get my error. can someone please help me with this? thanks a lot! -- Kiran -- http://mail.python.org/mailman/listinfo/python-list
Re: return tuple from C to python (extending python)
Farshid Lashkari wrote: > Simon Forman wrote: > > I have not done a great deal of extension work with python, however, I > > do not believe you can simply cast an int (or pointer to int, which is > > what you say dat is declared as, unless my C is /really/ rusty) to > > PyObject*. > > > > I think you need to do something like Py_BuildValue("i", 123), but see > > http://docs.python.org/ext/buildValue.html for more info. > > Simon is correct. You need to create a python object from your unsigned > int. Try the following instead: > > PyTuple_SET_ITEM(toRet, i, PyInt_FromLong(dat[i]) ); > > -Farshid That did the trick. thanks guys both for your help! -- http://mail.python.org/mailman/listinfo/python-list
Namespace problems
Hello All, I am kind of a beginner to python, but here is the deal. I am writing a wxpython Application, in which I have a GUI. This GUI imports some other modules that I have written, using the format import mymodule as _MyModule Now, this GUI in addition to having all it's bells and whistles has a console (from pyshell), so that the user can run their own scripts inside this GUI. What I am trying to do is to get these scripts that the user runs to be able to see all the other objects created and modules imported by the GUI. To make this clear, what I want to be able to do for example is in my script, do , dir(mymodule), already having imported mymodule in the GUI. Any ideas on how to make this happen? I don't want to import mymodule in this script, i want this script to see the mymodule that I imported in the main GUI. thanks a lot for your help, Kiran -- http://mail.python.org/mailman/listinfo/python-list
Re: Namespace problems
I should note that if you use the execfile command in the console, the script runs, but if you import the script, it says it cant find the module -- http://mail.python.org/mailman/listinfo/python-list
wxPython, tree Control text cutoff
Hello all, I am using a tree to display stuff, and it is constantly updated, but what I have noticed is in the lowest level, there is clearly noticable cutoff of the text I place there. The cutoff is existent even if I do not update the text inside the tree constantly. It seems that the text is halfway below where it should line up. I tried placing an image to see if that would correct it, but it does not. The image is perfectly lined up, but the text is still misaligned. Any known issues of this and how to fix it? By the way, it happens in both Linux and Windows. thanks a lot for your help! here is the code that I am using, I realize that it is a bit convoluted, but the parts where I am setting the text should be evident. import wx import wx.gizmos as gizmos class AlarmsWindow(wx.MDIChildFrame): def __init__(self, parent, title, size, pos): wx.MDIChildFrame.__init__(self, parent, -1, title, size = size, pos = pos) self.tree = gizmos.TreeListCtrl(self, -1, style = wx.TR_DEFAULT_STYLE | wx.TR_FULL_ROW_HIGHLIGHT) # images of the tree isz = (16,16) il = wx.ImageList(isz[0], isz[1]) self.fldridx = il.Add(wx.ArtProvider_GetBitmap(wx.ART_FOLDER, wx.ART_OTHER, isz)) self.fldropenidx = il.Add(wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN, wx.ART_OTHER, isz)) self.fileidx = il.Add(wx.ArtProvider_GetBitmap(wx.ART_NORMAL_FILE, wx.ART_OTHER, isz)) self.selidx = il.Add(wx.ArtProvider_GetBitmap(wx.ART_CROSS_MARK, wx.ART_OTHER, isz)) self.tree.SetImageList(il) self.il = il # create some columns self.tree.AddColumn("Connection") self.tree.AddColumn("Alarm") self.tree.AddColumn("Value") self.tree.SetMainColumn(0) self.root = self.tree.AddRoot("Connections") self.tree.SetItemImage(self.root, self.fldridx, which = wx.TreeItemIcon_Normal) self.tree.SetItemImage(self.root, self.fldropenidx, which = wx.TreeItemIcon_Expanded) self.connectionsName = [] self.connections = [] self.registers = [] self.tree.Expand(self.root) self.tree.GetMainWindow().Bind(wx.EVT_RIGHT_UP, self.OnRightUp) self.Show() # testing self.AddConnection("Dummy") self.AddRegister("Dummy", "R5") self.AddAlarm("Dummy", "R5", "LOA", "10") self.UpdateAlarm("Dummy", "R5", "LOA", "14") self.AddAlarm("Dummy", "R5", "LOS", "1354") self.AddRegister("Dummy", "R6") self.AddAlarm("Dummy", "R6", "LOA", "15") self.AddConnection("DUMMY @#2") self.AddRegister("DUMMY @#2", "R0") self.AddAlarm("DUMMY @#2", "R0", "LSKJDF", "S:LKJDF") # tree control def OnRightUp(self, evt): pos = evt.GetPosition() item, flags, col = self.tree.HitTest(pos) if item: print('Flags: %s, Col:%s, Text: %s' % (flags, col, self.tree.GetItemText(item, col))) # tree control def OnSize(self, evt): self.tree.SetSize(self.GetSize()) # adds a section to the logger def AddConnection(self, name): self.connectionsName.append(name) self.connections.append([]) child = self.tree.AppendItem(self.root, name) self.connections[(len(self.connectionsName)-1)].append(child) self.tree.SetItemText(child, name) self.tree.SetItemImage(child, self.fldridx, which = wx.TreeItemIcon_Normal) self.tree.SetItemImage(child, self.fldropenidx, which = wx.TreeItemIcon_Expanded) # adds a register def AddRegister(self, connection, name): # find the connection index = -1 for i in range(len(self.connectionsName)): if self.connectionsName[i] == connection: index = i break if index != -1: self.connections[index].append([self.tree.AppendItem(self.connections[index][0], name)]) # adds a message to a specific section def AddAlarm(self, connection, register, alarm, value): # find the connection for i in range(len(self.connectionsName)): if self.connectionsName[i] == connection: # find the register for j in range(1, len(self.connections[i])): if self.tree.GetItemText((self.connections[i][j])[0]) == register:
Re: wxPython, tree Control text cutoff
Ah, dang. Nice find! thanks a lot for your help. Also, your note is completely called for. I realize that my code was very complicated, and I just pasted what I had instead of simplifying it down. Next time, I will do so. thanks again! Kiran jean-michel bain-cornu wrote: > Kiran a écrit : > > Hello all, > > I am using a tree to display stuff, and it is constantly updated, but > > what I have noticed is in the lowest level, there is clearly noticable > > cutoff of the text I place there. The cutoff is existent even if I do > > not update the text inside the tree constantly. It seems that the text > > is halfway below where it should line up. I tried placing an image to > > see if that would correct it, but it does not. The image is perfectly > > lined up, but the text is still misaligned. > > > > Any known issues of this and how to fix it? By the way, it happens in > > both Linux and Windows. > Hi Kiran, > It works fine if you change : > x = self.tree.AppendItem(self.connections[i][j][0], "") > to > x = self.tree.AppendItem(self.connections[i][j][0], " ") > I let you imagine the explanation... > Regards, > jm > > Just a hint : it'd be helpfull to solve such a bug if you make your > program more simple. To find out the solution, I reduced your program to > what's following, and the light came : > > import wx > import wx.gizmos as gizmos > > class AlarmsWindow(wx.MDIChildFrame): > def __init__(self, parent, title, size, pos): > wx.MDIChildFrame.__init__(self, parent, -1, title, size = size, > pos =pos) > self.tree = gizmos.TreeListCtrl(self, -1, style = > wx.TR_DEFAULT_STYLE| wx.TR_FULL_ROW_HIGHLIGHT) > # create some columns > self.tree.AddColumn("Connection") > self.tree.AddColumn("Alarm") > self.tree.AddColumn("Value") > self.tree.SetMainColumn(0) > > self.root = self.tree.AddRoot("Connections") > self.tree.Expand(self.root) > self.tree.GetMainWindow().Bind(wx.EVT_RIGHT_UP, self.OnRightUp) > self.Show() > > child = self.tree.AppendItem(self.root, 'name') > self.tree.SetItemText(child, 'name') > child2= self.tree.AppendItem(child,'name2') > ##x = self.tree.AppendItem(child2, "") > x = self.tree.AppendItem(child2, "XXX") > self.tree.SetItemText(x, 'alarm', 1) > self.tree.SetItemText(x, 'value', 2) > > def OnRightUp(self, evt): > pass > > class MDIFrame(wx.MDIParentFrame): > def __init__(self): > wx.MDIParentFrame.__init__(self, None, -1, "MDI Parent", size > =(600, 400)) > child = AlarmsWindow(self, "Alarm", (400, 300), (0, 0)) > > > if __name__=='__main__': > app = wx.PySimpleApp() > frame = MDIFrame() > frame.Show() > app.MainLoop() -- http://mail.python.org/mailman/listinfo/python-list
Segmentation fault only on Iinux
Hello All, In my program, I have a main thread which is the GUI (wxPython) and then a thread which goes and reads data from a socket. The reason this is in a different thread is because the data might take some time to come back, and I want to have the GUI to be responsive during this wait. When I run my program in Linux, a segmentation fault occurs. When I run it in Windows XP, it works just fine. The main thing that would be of interest is as follows: The segmentation fault does NOT occur if I disable the threads and read the data all in 1 thread (the main thread [gui's]). This leads me to believe it is some sort of threading problem related to linux. However, I personally dont think that it can be something wrong with my code, since my program runs perfectly fine in WindowsXP. I am also carefully protecting data that my threads share with the MainGUI using a Queue and also a semaphore lock. I know this is kind of hard to answer without any code, but would anybody know of some kind of issue such as this where there is some threading problems with Linux and not Windows. I am happy to send the code to anybody who wishes to see it. I havent posted it here because it is kind of lengthy. Also, I should note that I think we are running Linux Kernel 2.4 thanks a lot for your help, Kiran -- http://mail.python.org/mailman/listinfo/python-list
socket programming question
Hello All, My question is, is it possible to make python do some other processing while it is waiting for a socket to timeout? thanks a lot! Kiran -- http://mail.python.org/mailman/listinfo/python-list
Re: Segmentation fault only on Iinux
Unfortunately (i guess), I am not doing any XML. However, I am taking the previous suggestion of putting print lines in every other line of my code and then seeing where it crashes. Hopefully, that will solve the problem. thanks for the suggestions everybody -- Kiran Frank Millman wrote: > Kiran wrote: > > Hello All, > > In my program, I have a main thread which is the GUI (wxPython) and > > then a thread which goes and reads data from a socket. The reason this > > is in a different thread is because the data might take some time to > > come back, and I want to have the GUI to be responsive during this > > wait. > > > > When I run my program in Linux, a segmentation fault occurs. When I > > run it in Windows XP, it works just fine. > > > > Are you doing any xml processing? If so, it may be the same problem as > described in this recent post - > > http://tinyurl.com/l3nr7 > > Frank Millman -- http://mail.python.org/mailman/listinfo/python-list
wx.Yield() during socket timeout
Hello All, I am creating a socket connection in order to read and write to a location. My problem is,the gui becomes unresponsive if the socket times out. I know that a good solution is to have the socket read and write with a thread. However, I have tried this and have a problem where ONLY on linux does the program crash, it DOES NOT crash on windows xp. I have been trying to figure out why for about a week and have just given up. Instead, I am now tryign to use wx.Yield() which will allow the gui to be updated. However, during timeouts, the gui still hangs. Does anybody have any clever ideas on how I could call the function wx.Yield() during a timeout so that the GUI stays responsive? I have already tried timers, and they dont work. thanks for your help, Kiran -- http://mail.python.org/mailman/listinfo/python-list
socket buffer flush question
Hello Everybody! I am writing a networking application in python for a small piece of hardware, in which there could sometimes be timeouts. I am using sockets to communicate to this device. Data that is sent to the device is instructions for that piece of hardware, and data recieved is just responses from that hardware. When a timeout happens, for some reason extra data is stored inside the buffer, so when the timeout is over, that extra data (remember this data is instructions) is executed by the hardware, which I don't want. For timeout purposes, I want the socket to be nonblocking, but at the same time this means that I can't flush the buffer, which I think would solve the problem. I realize this is probably quite unclear, so below is a tcpdump which will explain what I mean. 15:10:37.667963 aurl06f2.39979 > 192.168.128.161.46667: P 481:493(12) ack 481 win 5840 (DF) 4500 0040 090c 4000 4006 599f 8fd1 06f2 c0a8 80a1 9c2b b64b 30c7 9289 a552 55df 8018 16d0 c3ec 0101 080a 0962 a1d9 0008 0e90 0001 f800 0110 15:10:51.107769 aurl06f2.39979 > 192.168.128.161.46667: P 481:493(12) ack 481 win 5840 (DF) 4500 0040 090d 4000 4006 599e 8fd1 06f2 c0a8 80a1 9c2b b64b 30c7 9289 a552 55df 8018 16d0 beac 0101 080a 0962 a719 0008 0e90 0001 f800 0110 15:10:51.108259 192.168.128.161.46667 > aurl06f2.39979: P 481:493(12) ack 493 win 5792 (DF) 4500 0040 5580 4000 3f06 0e2b c0a8 80a1 8fd1 06f2 b64b 9c2b a552 55df 30c7 9295 8018 16a0 dbf5 0101 080a 0008 2465 0962 a719 8000 0001 f800 0110 4d05 15:10:51.108283 aurl06f2.39979 > 192.168.128.161.46667: P 493:565(72) ack 493 win 5840 (DF) 4500 007c 090e 4000 4006 5961 8fd1 06f2 c0a8 80a1 9c2b b64b 30c7 9295 a552 55eb 8018 16d0 cb29 0101 080a 0962 a719 0008 2465 0001 f800 0110 0001 f800 0110 0001 f800 * NOTICE THE EXTRA DATA * 15:10:51.108731 192.168.128.161.46667 > aurl06f2.39979: P 493:505(12) ack 565 win 5792 (DF) 4500 0040 5581 4000 3f06 0e2a c0a8 80a1 8fd1 06f2 b64b 9c2b a552 55eb 30c7 92dd 8018 16a0 db99 0101 080a 0008 2465 0962 a719 8000 0001 f800 0110 4d0d 15:10:51.111760 aurl06f2.39979 > 192.168.128.161.46667: P 565:577(12) ack 505 win 5840 (DF) 4500 0040 090f 4000 4006 599c 8fd1 06f2 c0a8 80a1 9c2b b64b 30c7 92dd a552 55f7 8018 16d0 a867 0101 080a 0962 a719 0008 2465 0001 f800 0114 The last 3 words (32 bits/word) of the hex printout shows the condition. The first of the last 3 words is the instruction, in this case a read instruction: _0001. The second is the address: f800_0110 or f800_0114. The third is the data recieved. As you can see, the first 2 printouts are a timeout (it is much longer than this, but i didnt want to post all of that) because one machine is communicating to the other without a response. The third printout is when the machine recovers from the timeout, and it works fine. However, the printout after the machine recovers has some extra data at the end. This is the data I want to flush out of the buffer, but I cant really figure out how to do so. Sorry for the long post and thanks a lot for your help -- http://mail.python.org/mailman/listinfo/python-list
namespace problems
Hi all, I am trying to get the following to work, but cant seem to do it the way i want to. ok, so I come into python and do the following: >>> x = 1 then, i have a file called test.py in which i say: print x Now, after having defined x =1 in the python interpreter, i come in and say: import test it has a problem, which i can understand, because it is in its own namespace, but even if i say: from test import * the interpreter still gives me the error: NameError: name 'x' is not defined the only way i can get it to work is if i say: execfile('./test.py') how can i get this to work by importing and not execfile? thanks for your help! -- http://mail.python.org/mailman/listinfo/python-list
python executing windows exe
Hi everybody, I am making python run an executable using the os module. Here is my question. The executable, once it is running, asks the user to input a filename that it will process. Now, my question is how do i automate this. let me make this clear, it is not an argument you pass in when you type in the exe. An example below illustrates: THIS IS NOT WHAT YOU DO: nec2d.exe couple1.nec # couple1.nec is the file you want to prcess rather, what you do is in windows cmd: nec2d.exe PROGRAM PRINTS OUT STUFF* PROGRAM PRINTS OUT STUFF* PROGRAM PRINTS OUT STUFF* PROGRAM PRINTS OUT STUFF* Please enter input file: <- THIS IS WHERE THE USER IS ASKED TO TYPE IN THE FILENAME everybody thanks for your help -- Kiran -- http://mail.python.org/mailman/listinfo/python-list
Re: python executing windows exe
On Feb 1, 6:25 pm, "aspineux" <[EMAIL PROTECTED]> wrote: > First look if your .exe will accept to work that way ! > try in a DOS prompt > > > echo yourfilename | nec2d.exe > > or if the program expect more input, write them all in a file > ( myinputs.txt ) and try : > > > nec2d.exe < myinputs.txt > > If it works looks for module subprocess and more precisely object > subprocess.popen and method comunicate > > On 1 fév, 23:57, "Kiran" <[EMAIL PROTECTED]> wrote: > > > Hi everybody, > > I am making python run an executable using the os module. Here is > > my question. The executable, once it is running, asks the user to > > input a filename that it will process. Now, my question is how do i > > automate this. let me make this clear, it is not an argument you pass > > in when you type in the exe. An example below illustrates: > > > THIS IS NOT WHAT YOU DO: Hi everybody, What you guys said helped out a lot and I got it to do what I wanted. thanks!, Kiran > > nec2d.exe couple1.nec # couple1.nec is the > > file you want to prcess > > > rather, what you do is in windows cmd: > > > nec2d.exe > > PROGRAM PRINTS OUT STUFF* > > PROGRAM PRINTS OUT STUFF* > > PROGRAM PRINTS OUT STUFF* > > PROGRAM PRINTS OUT STUFF* > > Please enter input file: <- THIS IS WHERE THE USER IS ASKED > > TO TYPE IN THE FILENAME > > > everybody thanks for your help > > -- Kiran -- http://mail.python.org/mailman/listinfo/python-list
Files required for porting python
Hi ALL, I am newbie to python and wanted to port python on to some RTOS. The RTOS I am trying to port python is not posix compliant. First, I decided to port python on to windows and later I will port the same to my target system. [ This is just to minimize the effort being put port, debug and to stabilize]. I downloaded 2.6.1 python code and started looking through the code. I see lot of code with several files. I am not sure which code I should start with. Any help / link regarding this is appreciated. Thanks, Kiran -- http://mail.python.org/mailman/listinfo/python-list
basic question on loop & type casting / list/str/array
Hi. Pls check on below poython 3.9.x code & suggest how can i keep the string intactst in 2nd loop... ? these are aws ec2 ids >>> INSTANCE_ID = ['i-0dccf1ede229ce1','i-0285506fee62051'] >>> for i in INSTANCE_ID: ... print (i) ... i-0dccf1ede229ce1 i-0285506fee62051 >>> >>> >>> >>> for i in INSTANCE_ID: ... for j in i: ... print (j) ... i - 0 d c c f 1 e d e 2 2 9 c e 1 i - 0 2 8 5 5 0 6 f e e 6 2 0 5 1 >>> Thanks Kiran -- https://mail.python.org/mailman/listinfo/python-list
Help
Whenever Iam trying to run this 'New latest version python software 3.8.4 python ' but it doesn't show any install option tell me how to run this software and install new latest version of python plz reply sir thank you -- https://mail.python.org/mailman/listinfo/python-list
Help
Whenever Iam trying to run this 'New latest version python software 3.8.4 python ' but it doesn't show any install option and it say ' modify set up ' So tell what to do sir plz help me out. -- https://mail.python.org/mailman/listinfo/python-list
[no subject]
Hi, Sir my self kiran chawan studying in engineering and I have HP PC and windows edition is window 10, system type 64-bit operating system. So tell me which python version software is suitable for my PC okay and send me that software direct link okay thank you. -- https://mail.python.org/mailman/listinfo/python-list
multiple raw_inputs
Hi there! I m a python newbie,infact,I m a newbie to programming and I was suggested it was a good idea to start it with python. I was trying a program which needs three integers from the user.I got it by using raw_input thrice. Is there a better way(s) to do it? Can a user be prompted thrice with a single raw_input and something additional? thanks in advance, Kiran Saty -- http://mail.python.org/mailman/listinfo/python-list
time zone
how to set my mails recieving time to my local time(i am in malaysia) -- http://mail.python.org/mailman/listinfo/python-list
Configuring IDLE on Linux
Hello, I have upgraded to Python2.4 on my Red Hat 9.0 Linux box. I want to work with IDLE and ran a search to check it's presence. Here is what I get. [EMAIL PROTECTED] bin]# find / -iname idlelib /usr/local/lib/python2.4/idlelib [EMAIL PROTECTED] bin]# cd /usr/local/lib/python2.4/idlelib [EMAIL PROTECTED] idlelib]# python PyShell.py ** IDLE can't import Tkinter. Your Python may not be configured for Tk. ** How do I resolve this and get IDLE working? thanks in advance, Kiran Satya -- http://mail.python.org/mailman/listinfo/python-list
Re: Python proficiency test
I managed to take the test,though not it's entirety. I am still far being proficient in Python,but I really liked the thought-provoking questions in there. thanks so much. Kiran Satya On 7/23/06, Ian Parker <[EMAIL PROTECTED]> wrote: > In message <[EMAIL PROTECTED]>, Richard > Jones <[EMAIL PROTECTED]> writes > >Kent Johnson wrote: > >> I recently helped create an on-line Python proficiency test. The > >> publisher of the test is looking for beta testers to try the test and > >> give feedback. If you are interested, here is an announcement from the > >> publisher: > > > >Had a look. In between my browser blocking a popup on every page and the > >registration asking far more details that I felt necessary, I stopped > >before looking at the actual test. > > > > > >Richard > > > > Likewise, I wanted to see a sample test (for any subject) but couldn't > do that without a long-winded registration procedure. > > Regards > > Ian > -- > Ian Parker > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list
Is there a memory leakage in this embedded python code?
Hi All, I am working on embedded python on C these days. I feel there is a memory leakage in this code. I have used our own memory pool and all the python code will use the heap from this memory pool. RunScript(pScriptName,pFuncName,...) { PyEval_AcquireLock() threadState = Py_NewInterpreter(); PyThreadState_Swap(threadState); /* Import the script module and run the fnc in that script module */ Pyobject *pModule = PyImport_Import(pScriptName); PyObject *pFunc = PyObject_GetAttrString(pModule, pFuncName); /* End running the script and calling the script fnc */ Py_EndInterpreter(threadState); PyEval_ReleaseLock(); } Befor running this code i checked my memory heap pool available memory. Then i called the above function to run my script script1.py. Script ran succesfully, but after completion of the above fnc, when i checked the memory there is a huge KB of memory is used by this code. I have no doubt on my memory pool implementation, bcoz it isworking from many years. Now, My doubt is, when i call Py_EndInterpreter at the end does it not clear the whole memory which was used in executing the script? Or still the imported stuff from the script1.py is in memory only? Would greatly appreciate the help vishnu -- http://mail.python.org/mailman/listinfo/python-list
[no subject]
hi have to parse a very complex dumps(whatever it is), i have done the parsing thruogh python.since the parsed data is very huge in amount, i have to feed it in the database (SQL), I have also done this... now the thing is i have to compare the data now present in the sql. in actual i have to compare the data of 1st dump with the data of the 2nd dump. the both dump have the same fields(attributes) but the values of their field may be change... so i have to detect this change.. for this i have to do the comparison... i.e, let i have a tableA ,its 1st row carry the data of dump1 and then on the 2nd day the data comes from dump2 go into the next row of tableA. and i have to compare both rows. but i dont have the idea how to do this all using python as my front end. plz pl anyone help me:( _ Show them the way! Add maps and directions to your party invites. http://www.microsoft.com/windows/windowslive/products/events.aspx-- http://mail.python.org/mailman/listinfo/python-list
Re: Learning Python in a group
You can count me in too.I've been into python for sometime now. I agree that a collaborative learning makes it fun and helps you reach your goal faster. -- http://mail.python.org/mailman/listinfo/python-list
Re: Files required for porting python
I will try to provide the API's on windows that my RTOS provides ex. If my RTOS has "fosCreateSemaphore" to create a semaphore I will implement the same API [ same function prototype] on windows using win32 CreateSemaphore. Similarly I will write a wrapper functions for accesing file system, task manegement, memory management. With this abstraction layer, I am simulating my target RTOS on windows [ I am ignoring realtime requirement on windows, I will worry about it once I am done with python porting]. Hope you understand the way I am going. Thanks, Kiran On Mon, Feb 22, 2010 at 10:30 PM, Shashwat Anand wrote: > what do you exactly mean by "port python on to windows" ? Are you talking > about your application or python itself :-/ > > ~l0nwlf > > On Mon, Feb 22, 2010 at 10:23 PM, KIRAN wrote: > >> Hi ALL, >> >> I am newbie to python and wanted to port python on to some RTOS. The >> RTOS I am trying to port python is not posix compliant. First, I >> decided to port python on to windows and later I will port the same to >> my target system. [ This is just to minimize the effort being put >> port, debug and to stabilize]. I downloaded 2.6.1 python code and >> started looking through the code. I see lot of code with several >> files. I am not sure which code I should start with. Any help / link >> regarding this is appreciated. >> >> Thanks, >> Kiran >> -- >> http://mail.python.org/mailman/listinfo/python-list >> > > -- http://mail.python.org/mailman/listinfo/python-list
Re: Supported Platforms for Python
Hi there! Our team at IBM are exploring the possibility of implementing one of our products using Python. I had a query in this regard. As per IBM's policy, we list details of platforms that our product works on - including the flavors of OS, the versions supported (and sometimes, even the service packs, if it matters) so that it is un-ambiguous to our customers. As an example, you can have a look at this page. Suppose we are riding on Python (i.e., implementing using Python), we need to tell our customers in similar detail as to what platforms we support our products on. I tried to find information about the platforms on which Python is supported from your page. But, it does not detail the versions of OS supported. In this regard, I have the following questions. Thanks for taking your time to respond. 1. Is this information available somewhere? 2. I was pointed to PEP-11, which documents the platforms that are not supported. So, can we take that all active versions of Python (2.7.3 and 3.3, i believe) are supported on all the OS flavors that Python claims to run on -- unless mentioned otherwise in the PEP-11? 3. Also, regarding the following entries listed in the PEP-11. So, any idea which OSes implement these? Name: Linux 1 (Am guessing its the Linux kernel version 1.0?) Unsupported in: Python 2.3 Code removed in: Python 2.4 Name: Systems defining __d6_pthread_create (configure.in) Unsupported in: Python 2.3 Code removed in: Python 2.4 Name: Systems defining PY_PTHREAD_D4, PY_PTHREAD_D6, or PY_PTHREAD_D7 in thread_pthread.h Unsupported in: Python 2.3 Code removed in: Python 2.4 Name: Systems using --with-dl-dld Unsupported in: Python 2.3 Code removed in: Python 2.4 Name: Systems using --without-universal-newlines, Unsupported in: Python 2.3 Code removed in: Python 2.4 Name: Systems using --with-wctype-functions Unsupported in: Python 2.6 Code removed in: Python 2.6 Name: Systems using Mach C Threads Unsupported in: Python 3.2 Code removed in: Python 3.3 Name: Systems using --with-pth (GNU pth threads) Unsupported in: Python 3.2 Code removed in: Python 3.3 Name: Systems using Irix threads Unsupported in: Python 3.2 Code removed in: Python 3.3 Warm Regards, Kiran M N | Software Development (Rational Team Concert for Visual Studio.NET) | IBM Rational | India Software Labs | Email: kiran@in.ibm.com From: Michael Foord To: webmas...@python.org Cc: Kiran N Mallekoppa/India/IBM@IBMIN Date: 08-11-12 08:10 PM Subject:Re: Supported Platforms for Python On 8 Nov 2012, at 14:36, webmas...@python.org wrote: > On Thu, Nov 08, 2012, Kiran N Mallekoppa wrote: >> >> Suppose we are riding on Python (i.e., implementing using Python), we need >> to tell our customers in similar detail as to what platforms we support our >> products on. I tried to find information about the platforms on which >> Python is supported from your page. But, it does not detail the versions of >> OS supported. >> >> Is this information available somewhere? If not, can this be published on >> your site? > > Not really. ;-) You'll find some on > http://www.python.org/download/other/ > > However, Python is (mostly) plain C and Open Source, which essentially > means that support is available for any platform where people are willing > to invest resources. AIX in particular has always been one of the > problem platforms. > > What this means for you is that if IBM wants to allocate resources to get > Python running on any particular platform, it almost certainly can be > done, and we certainly would appreciate getting any such work contributed > back to the community. > > If you want more information, you're probably best off using one of the > discussion forums listed in your auto-reply. As an addendum note that there is a list of explicitly unsupported platforms (platforms that used to be supported and in which versions of Python support was removed): http://www.python.org/dev/peps/pep-0011/ You can see which platforms we test Python, and the test systems are considered stable, from our buildbots. The Python 2.7 ones are here: http://buildbot.python.org/all/waterfall?category=2.7.stable Another tangible way to support a platform is to provide and maintain a buildbot for running the Python tests on. All the best, Michael Foord > -- > Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ > > "Normal is what cuts off your sixth finger and your tail..." --Siobhan > -- http://www.voidspace.org.uk/ May you do good and not evil May you find forgiveness for yourself and forgive others May you share freely, never taking more than you give. -- the sqlite blessing http://www.sqlite.org/different.html -- http://mail.python.org/mailman/listinfo/python-list
good exercises for Beginner
Hi ALL, I am new to programming and python. In my quest to get good at programming, even when I am able to get through the python tutorials I feel for lack of exercises & examples that emphasises the programming logic skills. The examples are just introduction to particular definition of the concepts. I would appreciate if any one provide me the resources to find such exercise(irrespective of Programming language) , working on which would help to build to skills in programming for problem solving which is more critical. any tutorials or online links and also advise for newbie are highly appreciated Thank You in advance. Kanthi Narisetti -- http://mail.python.org/mailman/listinfo/python-list
Configure this group in email client
Hi All, I need in help for configuring python news site in Mozilla Thunderbird. What is the address of Python newsgroup site ? Any other newsgroups related to Python or any programming language will be appreicated. Regards, Kanthi -- http://mail.python.org/mailman/listinfo/python-list
Programming Language for Systems Administrator
Hi All, I am Windows Systems Administrator(planning to migrate to Linux administration in near future), I have occassionally written few batch files and Vbscripts to automate my tasks. Now I have strong interest to learn a programming language that would help me to write Scripts or Application ( In Systems Administrative point of view) . I have read on net that Python is the best way to start of for beginers , Please let me your suggestions and help me out to chose to the right programming language to write scripts ranging from simple automation scripts to appliations for my workflow. I am confused to chose between C++,Python,Perl. Thanks in Advance Kk -- http://mail.python.org/mailman/listinfo/python-list
Re: Programming Language for Systems Administrator
Hi All, Thank You for your suggestionsI request you all to eloborate the Uses(In Practical) for systems administrator.Some of my questions regarding the same follows. 1)Can i build web applications in Python ? If so how. I am planning to build a web application for intranet use which deals with workflow of Internal office communication. 2)Which is best opensource database to be used with Python ? 3)When i write a remote execution script in python is it required that python should be installed in remote system. 4)I heard about Perl/CGI and that CGI application done by python too.Is CGI still valid when PHP has taken over the WebApplication Development, Dominating. Sorry if these questions are out of this group , but answers to these ? will help me a lot. Thanks in Advance Kanthi. -- http://mail.python.org/mailman/listinfo/python-list
Problem with pexpect when executing a command on a remote machine
Hi, I am trying to execute a command on a remote machine for which I am using Python pexpect module. Iam able to connect and copy files to the remote machine but getting the following error when trying to execute commands on the remote machine. Please find the below error. ''Error sending command: cluster config -r -a Timeout exceeded in read_nonblocking().\n\nversion: 2.4 ($Revision: 516 $)\ncommand: /usr/bin/ssh\nargs: [\'/usr/bin/ssh\', \'-o\', \'ServerAliveInterval=60\', \'-o\', \'UserKnownHostsFile=/dev/null\', \'-o\', \'StrictHostKeyChecking=no\', \'root@192.168.7.1\', \'-p\', \'22\']\nsearcher: searcher_re:\n0: re.compile("(:[^\\r\\n]* #|[^\\r\\n]*] ->| [^\\r\\n]*][$#]|:[^\\r\\n]*[$#])")\nbuffer (last 100 chars): \x1b[0;10mcluster config -r -a\r\nConfiguration is OK!\r\nReloading configuration on all nodes\r\n\nbefore (last 100 chars): \x1b[0;10mcluster config -r -a\r\nConfiguration is OK!\r\nReloading configuration on all nodes\r\n\nafter: \nmatch: None\nmatch_index: None\nexitstatus: None\nflag_eof: False\npid: 28817\nchild_fd: 7\nclosed: False\ntimeout: 10\ndelimiter: \nlogfile: None\nlogfile_read: None\nlogfile_send: None\nmaxread: 2000\nignorecase: False\nsearchwindowsize: None\ndelaybeforesend: 0.05\ndelayafterclose: 0.1\ndelayafterterminate: 0.1' If we notice the error, the command is getting properly executed and the output is also fetched but it returning a TIMEOUT error in read_nonblocking() function of pxssh.py file of the pexpect module. Please let me know how can I avoid this. Even the error is not consistent, sometimes I am able to execute properly but it is failing most of the times. Kindly reply me as soon as possible. Thanks in advance. Regards, Kiran -- https://mail.python.org/mailman/listinfo/python-list
Problem with os.path
Hi All, I have a program which fetches the list of files inside a directory. For fetching this list I am making use of the glob.glob method which takes path as a parameter. For building the path I am making use of os.path.join. My code looks somewhat like this: --- import glob import os path = 'E:\mktrisk\service\marketdata\da' for filename in glob.glob(os.path.join(path,'*.java')): datafile = open(filename,'r').readlines() -- this program works fine when the string 'path' is not too long. When I pass a longer string as path, the program doesn't work. Now I am not sure whether its a limitation with the string class or with os.path. I am passing a valid path to the program and I am running this on Python 2.4.2 on Windows XP. Any help will be greatly appreciated. regards, Daya -- http://mail.python.org/mailman/listinfo/python-list
Python Exercises for Newbee
Hi ALL, I am Windows Administrator, moving little ahead from batch files and scripts I started learning Python. I found that Python is very easy and is very well documented. Still I am looking more than examples. As a beginner i want to do lot of excersice from simple addition to complex ...which help me to understand the concepets more clearly. I appreciate if any one can give me such exersices or any link for the same. Thank You , Kanthi Kiran -- http://mail.python.org/mailman/listinfo/python-list
implementing SFTP using Python
Hi Everybody, I have to implement SFTP conection from client to the server using Python script. Iam very new new to python , and i dont't have much time to complete this. So I need some pointers from you. If anybody has already done this kind of stuff, please let me know. Please don't think Iam over ambitious, but i need some kind of Pseudo code ,if possible source code. Thanks in Advance, K.Kiran Kumar - Never Miss an Email Stay connected with Yahoo! Mail on your mobile. Get started!-- http://mail.python.org/mailman/listinfo/python-list
Re: implementing SFTP using Python
@Ben Finney I have downloaded paramiko-1.6 package, pcrypto 2.0.1 package platform: windows XP Now Iam trying to run the demo scripts available with paramiko package. I have tried using the same system for both cleint(demo_simple.py) and the server(demo_server.py) but it is failing at socket.connect() Can you please tell me ..what all i need to setup , to establish a conection between Client and server. The log of error , when I run demo_simple: == Hostname: 10.220.10.15:22 hostnmae: 10.220.10.15 port: 22 Username [KiranKumar_Kadarla]: aditya Warning: Problem with getpass. Passwords may be echoed. Password for [EMAIL PROTECTED]: [EMAIL PROTECTED] *** Unable to open host keys file hostname:10.220.10.15 port:22 *** Caught exception: : Authentication failed. Traceback (most recent call last): File "C:\paramiko-1.6\paramiko-1.6\demos\demo_simple.py", line 85, in t.connect(username=username, password=password, hostkey=hostkey) File "C:\Python25\Lib\site-packages\paramiko\transport.py", line 851, in connect self.auth_password(username, password) File "C:\Python25\Lib\site-packages\paramiko\transport.py", line 1012, in auth_password return self.auth_handler.wait_for_response(my_event) File "C:\Python25\Lib\site-packages\paramiko\auth_handler.py", line 174, in wait_for_response raise e AuthenticationException: Authentication failed. Traceback (most recent call last): File "C:\paramiko-1.6\paramiko-1.6\demos\demo_simple.py", line 102, in sys.exit(1) SystemExit: 1 THANKS IN ADVANCE K. KIRAN KUMAR kadarla kiran kumar writes: > I have to implement SFTP conection from client to the server using > Python script. Iam very new new to python , and i dont't have much > time to complete this. So I need some pointers from you. You will probably want to investigate the "paramiko" package, a pure-Python implementation of the SSH2 protocol. - The fish are biting. Get more visitors on your site using Yahoo! Search Marketing.-- http://mail.python.org/mailman/listinfo/python-list
copying only recent files from one machine to another
Hi Everybody, Iam trying to copy files from one machine to another over SFTP connection. For that Iam using sftp.get & sftp.put methods. Now, I have to copy only recently created/modified files,i.e, based on timestamps from remote machine to my machine. Is there any standard implementation for that in python/paramiko ? If not , can anyone suggest me the efficient method to implement the same. Thanks in Advance, Kiran Kumar - No need to miss a message. Get email on-the-go with Yahoo! Mail for Mobile. Get started.-- http://mail.python.org/mailman/listinfo/python-list