Login using usrllib2
Hi All, I'm using urllib2 module to login to an https server. However I'm unable to login as the password is not getting accepted. Here is the code: import urllib2, urllib values={'Username': 'admin', 'Password': 'admin123'} url='https://172.25.17.20:9443' data = urllib.urlencode(values) data = urllib.urlencode(values) req = urllib2.Request(url, data) response = urllib2.urlopen(req) the_page = response.read() print the_page The error message I get in the_page output is the same as I get when I access this site using a browser and supply a wrong password. It appears password is not accepting. I'm new to web programming. The aim is to automate user clicks on a web server which can be replicated using python and http. Please suggest / help. Regards, Rajat -- http://mail.python.org/mailman/listinfo/python-list
Check file is locked?
How to check if a particular file is locked by some application? (i.e. the file is opened by some application)? -- Regrads, Rajat -- http://mail.python.org/mailman/listinfo/python-list
[Help] Python implmenentation of finding process's command line parameters.
I'm looking for some python implementation of finding the command line parameters of a process on Windows XP SP3 machine. I found some links but they all point me to the direction of c/c++ implememtations. I've seen WMI, but this takes time to load. So I just though if some one has done implementation and could pointing me in some right direction. Regards, Rajat -- http://mail.python.org/mailman/listinfo/python-list
Re: Python implmenentation of finding process's command line parameters.
I have had a look at psutil, however, this only works with Python 2.6.x and above. We are using Python 2.5.2 and updating python could pose certain problems. So, I'm not keep on using psutils. -- Regrads, Rajat -- http://mail.python.org/mailman/listinfo/python-list
Access NtQueryInformationProces() from Python
Hi, I'm looking for a way to call the NtQueryInformationProces() and ReadProcessMemory() of WindowsXP from Python. Can anyone direct me to some examples where they have been successfully called through Python? Thanks and regards, Rajat Notice: This e-mail is intended solely for use of the individual or entity to which it is addressed and may contain information that is proprietary, privileged, company confidential and/or exempt from disclosure under applicable law. If the reader is not the intended recipient or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If this communication has been transmitted from a U.S. location it may also contain data subject to the International Traffic in Arms Regulations or U.S. Export Administration Regulations and cannot be disseminated, distributed or copied to foreign nationals, residing in the U.S. or abroad, without the prior approval of the U.S. Department of State or appropriate export licensing authority. If you have received this communication in error, please notify the sender by reply e-mail or collect telephone call and delete or destroy all copies of this e-mail message, any physical copies made of this e-mail message and/or any file attachment(s). -- http://mail.python.org/mailman/listinfo/python-list
How to get filename from a pid?
Hi, I've a PID of a process (the process is a notepad application), I want to know which file is opened by this process. regards, Rajat Notice: This e-mail is intended solely for use of the individual or entity to which it is addressed and may contain information that is proprietary, privileged, company confidential and/or exempt from disclosure under applicable law. If the reader is not the intended recipient or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If this communication has been transmitted from a U.S. location it may also contain data subject to the International Traffic in Arms Regulations or U.S. Export Administration Regulations and cannot be disseminated, distributed or copied to foreign nationals, residing in the U.S. or abroad, without the prior approval of the U.S. Department of State or appropriate export licensing authority. If you have received this communication in error, please notify the sender by reply e-mail or collect telephone call and delete or destroy all copies of this e-mail message, any physical copies made of this e-mail message and/or any file attachment(s). -- http://mail.python.org/mailman/listinfo/python-list
How to check if file is open on Windows XP?
Hi, I'm looking for a fascility that can check if the file is open on Windows XP and if the file is open (say a notepad file is open), I want to close that file (i.e the notepad application) I found that there are no such methods available in OS modules. Is using Win32 API is the only solution? Pleae suggest. Thanks, Rajat Notice: This e-mail is intended solely for use of the individual or entity to which it is addressed and may contain information that is proprietary, privileged, company confidential and/or exempt from disclosure under applicable law. If the reader is not the intended recipient or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If this communication has been transmitted from a U.S. location it may also contain data subject to the International Traffic in Arms Regulations or U.S. Export Administration Regulations and cannot be disseminated, distributed or copied to foreign nationals, residing in the U.S. or abroad, without the prior approval of the U.S. Department of State or appropriate export licensing authority. If you have received this communication in error, please notify the sender by reply e-mail or collect telephone call and delete or destroy all copies of this e-mail message, any physical copies made of this e-mail message and/or any file attachment(s). -- http://mail.python.org/mailman/listinfo/python-list
ctypes for Jython?
Hi All, Is ctypes or something like this available for Jython? -- Regards, Rajat -- http://mail.python.org/mailman/listinfo/python-list
Re: Is ctypes appropriate in my case?
On Wed, Oct 29, 2008 at 6:51 PM, Terry Reedy [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: Hi, I've a dll and its header file that controls an hardware. I want to write a wrapper for this dll in Python. What is the best way that I can write a wrapper? What do you want to do with the wrapper? I'm intending to use STAF - software testing automation framework where I want to test this dll. Test cases for STAF are written in xml and python. So for this I want to write a wrapper class for this dll in python that has Dll API's as the member function of the wrapper class. This class will be in a python module. This module can be then be imported in the test cases thereby exposing the dll APIs for testing. Please suggest if there are better solutions around. I know ctypes modules and have used it before. As far as I know ctypes is only used to call the dll functions in a python module. I am not sure what you mean here. Python code can directly import and call functions in dlls that represent Python extension modules and that are placed in the Pythonxx/dlls directory in your Windows Python installation. Ctypes is mostly used to call functions in a dll that is *not* a python extension module, that was not written for Python. -- http://mail.python.org/mailman/listinfo/python-list Well I did not know this. What is a Python extension module? -- Regrads, Rajat -- http://mail.python.org/mailman/listinfo/python-list
Re: Is ctypes appropriate in my case?
For CPython, an importable module written in C. There is a doc Extending and Embedding the Python Interpreter. But I expect you can write the class in Python with ctypes. Thanks Terry. I'll be using ctypes now and have started writing the class. But the problem is that there are some 150 APIs exposed by the dll. Is there any tool that can autogenerate some of the member functions for the class since new APIs might as well get added in future. Could SWIG be of use here? Cheers, Rajat -- http://mail.python.org/mailman/listinfo/python-list
Is ctypes appropriate in my case?
Hi, I've a dll and its header file that controls an hardware. I want to write a wrapper for this dll in Python. What is the best way that I can write a wrapper? I know ctypes modules and have used it before. As far as I know ctypes is only used to call the dll functions in a python module. This is not appropriate for writing a wrapper. Please suggest some way to write a wrapper. Thanks and regards, Rajat -- http://mail.python.org/mailman/listinfo/python-list
Module or script for backup
Hi, Is there a module or script already written for creating backup of files ? -- Regrads, Rajat -- http://mail.python.org/mailman/listinfo/python-list
Getting windows error while making a backup
Hi, I've this backup script that having some problems. Please some one suggest what is that I'm missing in it. This backup script deletes the previous backups and then create a new backup by simply renaming the original folder to backup folder and creates a new folder. The folder contains many files and folders and many .svn (i.e. hidden and readonly files and directories) Well things seems to be done correctly but at times while renaming the folder to backup I get this error WindowsError: [Error 5] Access is denied Here is my code: The thread class that removes the hidden and readonly permission from files and folders. Then using shutil.rmtree to delete the files import threading import win32con import win32api import win32file import sys import shutil sys.setrecursionlimit(5000) class delDirTreeThread(threading.Thread): def __init__(self, path): self.path = path threading.Thread.__init__(self) def run(self): self.delRecursive(self.path) shutil.rmtree(self.path) def delRecursive(self, path): for file in os.listdir(path): file_or_dir = os.path.join(path,file) if os.path.isdir(file_or_dir): print file_or_dir print file_or_dir: %s - %d %(file_or_dir, win32file.GetFileAttributesW(file_or_dir)) if win32file.GetFileAttributesW(file_or_dir) != win32con.FILE_ATTRIBUTE_NORMAL: win32file.SetFileAttributesW(file_or_dir, win32con.FILE_ATTRIBUTE_NORMAL) if os.listdir(file_or_dir) != []: self.delRecursive(file_or_dir) #it's a directory recursive call to function again else: print file_or_dir print ELSE - file_or_dir: %s - %d %(file_or_dir, win32file.GetFileAttributesW(file_or_dir)) if win32file.GetFileAttributesW(file_or_dir) != win32con.FILE_ATTRIBUTE_NORMAL: win32file.SetFileAttributesW(file_or_dir, win32con.FILE_ATTRIBUTE_NORMAL) #os.remove(file_or_dir) #it's a file, delete it From some part in application I call this threading class as: delTree = delDirTreeThread(subdir) delTree.start() delTree.join() subdir is the absolute path to the directory tree for which I want to create a new backup and delete the older ones. The very reason I did this inside a thread is because I want application to wait until the backup created (making sure that the older ones are deleted and new one created) Can some one help in this? Regards, Rajat -- http://mail.python.org/mailman/listinfo/python-list
How to delete readonly and hidden files directories on windows xp?
Hi, I'm using Windows XP and I'm looking for way out to remove .svn folders from my directory. But I'm unable to do that. Does any one one has written any script for removing the hidden / readonly files or directories? Regards, Rajat -- http://mail.python.org/mailman/listinfo/python-list
Ctypes behave differenty on windows 2000 and windows XP
Hi, Im facing a strange problem with ctypes module on windows 2000. I did not face this problem with the windows Xp. The problem is this code and specifically c_long which behave differently on win2000 and winxp from ctypes import * h = windll.LoadLibrary(C:\\Windows\\System32\\myDll.dll) print h ver = getattr(h, myDll_GetVersion) versionArr = c_long * 4 version = versionArr(0, 0, 0, 0) print ver(version) dllVersionStr = v%d.%d.%d.%d % tuple(version) print dllVersionStr The same code appears to work on windows xp with dllVersionStr printing as v1.3.5.0 But on wIindows 2000 it prints v0.0.0.0 Please suggest why does it happen. Thanks and regards, Rajat -- http://mail.python.org/mailman/listinfo/python-list
Using Tkinter and Tix together opens a new DOS Window in addition to the actual GUI on windows XP
Hi, I m using Tkinter and Tix. I'm using Tkinter mainly for all the widgets except for the TixComboBox for which I use Tix. My event loop starts like this: myRoot = Tix.Tk() myRoot.title(Test Automation)# myAppGUIObject = myAppGUI(myRoot, logger) #myAPPGUI is the class for creating GUI myRoot.mainloop() The problem is as soon as I doubel click on this script a DOS window opens up in addition to the GUI. I don't why is this happening? I assume the problem is becuase I'm using the statement: Tix.Tk() when I'm using tix for only a combo box and the rest of the widgets are tkinter widgets. So, 1. Is the above approach fine? 2. How can I stop the dos window from opening up? -- Regrads, Rajat -- http://mail.python.org/mailman/listinfo/python-list
Tix: Windows XP: Problem - how to stop root window from popping up with Tix
Hi, Im using Tix on widows XP and I've tried many ways to suppress the root window. But so far I'm unable to do it. Please suggest how can I suppress the root window. My code is as follows: import Tix myRoot = Tix.Tk() myRoot.withdraw() myRoot.deiconify() myRoot.title(Test Automation) #Create GUI Object and pass the logger object myAppGUIObject = myAppGUI(myRoot, logger) #My AppGUI class creates the GUI which heavily uses the Tkinter widgets and only TixComboBox myRoot.mainloop() Please suggest if there is anything I'm missing. Thanks and regards, Rajat -- http://mail.python.org/mailman/listinfo/python-list
Re: Tix: Windows XP: Problem - how to stop root window from popping up with Tix
On Wed, Oct 1, 2008 at 11:44 AM, Lie Ryan [EMAIL PROTECTED] wrote: On Wed, 01 Oct 2008 11:33:59 +0100, dudeja.rajat wrote: Hi, Im using Tix on widows XP and I've tried many ways to suppress the root window. But so far I'm unable to do it. Please suggest how can I suppress the root window. My code is as follows: import Tix myRoot = Tix.Tk() myRoot.withdraw() myRoot.deiconify() myRoot.title(Test Automation) #Create GUI Object and pass the logger object myAppGUIObject = myAppGUI(myRoot, logger) #My AppGUI class creates the GUI which heavily uses the Tkinter widgets and only TixComboBox myRoot.mainloop() Please suggest if there is anything I'm missing. Thanks and regards, Rajat The root window is the main window, not the DOS box. I think in windows, you should use pythonw.exe or something to open the python script so not to open a dos box. -- http://mail.python.org/mailman/listinfo/python-list No, even that does not help. :-( -- Regards, Rajat -- http://mail.python.org/mailman/listinfo/python-list
Tkinter on WIndows XP opens a blank screen. How can I get rid of it?
Hi, I m using Tkinter and Tix to create a GUI on Windows XP. So far I've created the GUI and it just works. But the problem is as soon as I double click on the script it besides opening the GUI also opens a shell ( a blank screen) with it. Pleas suggest how can I get rid of this blank screen. My program is staring as : myRoot = Tix.Tk() myRoot.title(Test Automation) some stuff ... myRoot.mainloop() Thanks and regadrs, Rajat -- http://mail.python.org/mailman/listinfo/python-list
Tix Combo box problem - remains in editable mode only
Hi I'm facing a problem with the tix combo box in a way that my combo box is always in an editable mode after I have cleared subwidgets Entry and Listbox from it. My setup is like this : CheckButton1 : If this is unset, the combo box should get disabled, the entries in it should get cleared ( entries are listbox and entry subwidgets) which in my case they get cleared. When this check box is set again, the combo box should get enabled, with no entries in listbox and entry subwidgets ( which are reallly cleared in my case.) But the combox box having being enabled is in editable mode despite of setting it to un-editable mode. The code is as follows: #Combo Box self.cbAnalysisLibVersion = Tix.ComboBox(self.frame1, \ dropdown = True, \ command=self.__cllbkAnalysisLibVer, \ editable=0, \ variable=verSelection, options='listbox.height 8\ listbox.width 25 \ entry.width 30 \ entry.anchor w \ entry.padx 30', \ history = False) #Check Button box self.chBtResultsComparison = Checkbutton(self.frame2, \ text = Results Comparison, \ variable = varResultsComparison, \ command = self.__cllbkResultsComparison) def __cllbkResultsComparison(self, Event = None): subLB = self.cbAnalysisLibVersion.subwidget(listbox) subEntry = self.cbAnalysisLibVersion.subwidget(entry) if varResultsComparison.get() != 1: #Disable Tolerance Text Box self.txtTolerance.delete(1.0, END) self.txtTolerance.config(state = DISABLED, \ bg = grey) #Delete all entries (entry subwidget's entries) #in Reference Analysis Results Version Combo Box #and disable this combo box. #First Delete the Listbox sub-widget entries subLB.delete(0, END) subLB.config(state = DISABLED) #Then delete Entry sub-widget entries #subEntry = self.cbAnalysisLibVersion.subwidget(entry) subEntry.config(state = NORMAL) subEntry.delete(0, END) subEntry.config(state = DISABLED) self.cbAnalysisLibVersion.config(state = DISABLED) #Diable Result Comparison Button self.btViewComparisonResults.config(state = DISABLED) else: #Check box is ticked #Enable the Tolerance text box self.txtTolerance.config(state = NORMAL, \ bg = white) #Enable the Reference Analysis Combo box #self.cbAnalysisLibVersion.config(state = NORMAL, editable=0) self.cbAnalysisLibVersion.configure(state = NORMAL, editable = 0) subLB.config(state = NORMAL) subEntry.config(state = NORMAL) self.btViewComparisonResults.config(state = NORMAL) Please suggest what is that I am missing Regards, Rajat -- http://mail.python.org/mailman/listinfo/python-list
Re: Tix Combo box problem - remains in editable mode only
On Tue, Sep 30, 2008 at 11:57 AM, [EMAIL PROTECTED] wrote: Hi I'm facing a problem with the tix combo box in a way that my combo box is always in an editable mode after I have cleared subwidgets Entry and Listbox from it. My setup is like this : CheckButton1 : If this is unset, the combo box should get disabled, the entries in it should get cleared ( entries are listbox and entry subwidgets) which in my case they get cleared. When this check box is set again, the combo box should get enabled, with no entries in listbox and entry subwidgets ( which are reallly cleared in my case.) But the combox box having being enabled is in editable mode despite of setting it to un-editable mode. The code is as follows: #Combo Box self.cbAnalysisLibVersion = Tix.ComboBox(self.frame1, \ dropdown = True, \ command=self.__cllbkAnalysisLibVer, \ editable=0, \ variable=verSelection, options='listbox.height 8\ listbox.width 25 \ entry.width 30 \ entry.anchor w \ entry.padx 30', \ history = False) #Check Button box self.chBtResultsComparison = Checkbutton(self.frame2, \ text = Results Comparison, \ variable = varResultsComparison, \ command = self.__cllbkResultsComparison) def __cllbkResultsComparison(self, Event = None): subLB = self.cbAnalysisLibVersion.subwidget(listbox) subEntry = self.cbAnalysisLibVersion.subwidget(entry) if varResultsComparison.get() != 1: #Disable Tolerance Text Box self.txtTolerance.delete(1.0, END) self.txtTolerance.config(state = DISABLED, \ bg = grey) #Delete all entries (entry subwidget's entries) #in Reference Analysis Results Version Combo Box #and disable this combo box. #First Delete the Listbox sub-widget entries subLB.delete(0, END) subLB.config(state = DISABLED) #Then delete Entry sub-widget entries #subEntry = self.cbAnalysisLibVersion.subwidget(entry) subEntry.config(state = NORMAL) subEntry.delete(0, END) subEntry.config(state = DISABLED) self.cbAnalysisLibVersion.config(state = DISABLED) #Diable Result Comparison Button self.btViewComparisonResults.config(state = DISABLED) else: #Check box is ticked #Enable the Tolerance text box self.txtTolerance.config(state = NORMAL, \ bg = white) #Enable the Reference Analysis Combo box #self.cbAnalysisLibVersion.config(state = NORMAL, editable=0) self.cbAnalysisLibVersion.configure(state = NORMAL, editable = 0) subLB.config(state = NORMAL) subEntry.config(state = NORMAL) self.btViewComparisonResults.config(state = NORMAL) Please suggest what is that I am missing Regards, Rajat Any help guys? -- Regrads, Rajat -- http://mail.python.org/mailman/listinfo/python-list
Backup a directory
Hello, I'm looking for a script that creates a backup of a directory but keeps only one backup. I've tried using all the os modules commands but could not create one. Does any one has any such custom script or function? Thanks and regards, rajat -- http://mail.python.org/mailman/listinfo/python-list
os.path.exists() function does not work for http paths
Hi, I have used os.path.exists() many a times for any file system paths in local system. But this does not seem to work for an Http path. e.g: To check is the Results folder exists at the following path, I do: if not os.path.exists(http://subversion.myCom.com/Testing/Results;): print 'Path does not exist' This always prints the above print statements whether or not the Results folder exists or not. Is there any such function to check existence of files. / folder at Http paths? -- Thanks and regards, Rajat -- http://mail.python.org/mailman/listinfo/python-list
Re: Tkinter: scrollbar - unable to scroll the scrollbar if I click on arrow buttons of scroll bars
On Sun, Sep 28, 2008 at 4:51 PM, [EMAIL PROTECTED] wrote: Hi, Im using a tkinter scrollbars for horinzontal and vertical scrolling. Well the problem is I'm unable to scroll if I click on the arrows buttons of scrollbars ( with both types of scrollbars) Please suggest if I m missing some configuration. My code is as below: self.hsb = Scrollbar(appGuiFrame, orient = HORIZONTAL) self.hsb.grid(row = 2,column = 0, sticky = E+W) #vertical scroll bar self.vsb = Scrollbar(appGuiFrame) self.vsb.grid(row = 1,column = 2, sticky = N+S) self.txtLogger = Text(appGuiFrame, \ height = 20,\ width = 100, \ state = DISABLED, \ xscrollcommand = self.hsb.set, \ yscrollcommand = self.vsb.set, \ wrap = NONE, \ font = (courier,12)) self.hsb.config(command = self.txtLogger.xview()) self.vsb.config(command = self.txtLogger.yview()) Please help. Thanks and regards, Rajat Hi folks, Any help on the above problem. Regards, Rajat -- http://mail.python.org/mailman/listinfo/python-list
Re: Tkinter: scrollbar - unable to scroll the scrollbar if I click on arrow buttons of scroll bars
On Mon, Sep 29, 2008 at 5:10 PM, [EMAIL PROTECTED] wrote: On Sun, Sep 28, 2008 at 4:51 PM, [EMAIL PROTECTED] wrote: Hi, Im using a tkinter scrollbars for horinzontal and vertical scrolling. Well the problem is I'm unable to scroll if I click on the arrows buttons of scrollbars ( with both types of scrollbars) Please suggest if I m missing some configuration. My code is as below: self.hsb = Scrollbar(appGuiFrame, orient = HORIZONTAL) self.hsb.grid(row = 2,column = 0, sticky = E+W) #vertical scroll bar self.vsb = Scrollbar(appGuiFrame) self.vsb.grid(row = 1,column = 2, sticky = N+S) self.txtLogger = Text(appGuiFrame, \ height = 20,\ width = 100, \ state = DISABLED, \ xscrollcommand = self.hsb.set, \ yscrollcommand = self.vsb.set, \ wrap = NONE, \ font = (courier,12)) self.hsb.config(command = self.txtLogger.xview()) self.vsb.config(command = self.txtLogger.yview()) Please help. Thanks and regards, Rajat Hi folks, Any help on the above problem. Regards, Rajat Hi, The problem got solved. After finding for such a long time I got a snippet at google and used the same in my code. It solved the problem. Here is the complete code now: class cLogToGUI: def __init__(self, logObj, appGUI): self.__logger = logObj self.__logger.debug(Inside cLogToGUI::__init__) appGuiFrame = appGUI.frame4 #hor. scroll bar self.hsb = Scrollbar(appGuiFrame, orient = HORIZONTAL) self.hsb.grid(row = 2,column = 0, sticky = E+W) #vertical scroll bar self.vsb = Scrollbar(appGuiFrame) self.vsb.grid(row = 1,column = 2, sticky = N+S) self.txtLogger = Text(appGuiFrame, \ height = 20,\ width = 100, \ state = DISABLED, \ xscrollcommand = self.hsb.set, \ yscrollcommand = self.vsb.set, \ wrap = NONE, \ font = (courier,12)) #self.hsb.config(command = self.txtLogger.xview()) #self.vsb.config(command = self.txtLogger.yview()) self.hsb.config(command = self.__hsbScrollHandler) self.vsb.config(command = self.__vsbScrollHandler) self.txtLogger.bind(updateDisplay, self.outputText) self.txtLogger.grid(row = 1) self.txtLogger.tag_configure(error, foreground = red) self.txtLogger.tag_configure(warning, foreground = orange) self.txtLogger.tag_configure(success, foreground = blue) self.__logger.debug(return from cLogToGUI::__init__) def outputText(self, event): self.__logger.debug(Inside cLogToGUI::outputText()) self.txtLogger.configure(state = NORMAL) string = TASymbols.strScrolledTextLine tag = TASymbols.strScrolledTextLineTag if not string: self.txtLogger.delete('1.0', END) else: self.txtLogger.insert(END, string, tag) #self.txtLogger.focus() self.txtLogger.see(END) self.txtLogger.configure(state = DISABLED) self.__logger.debug(return from cLogToGUI::outputText()) def __hsbScrollHandler(self, *L): op, howMany = L[0], L[1] if op == scroll: units = L[2] self.txtLogger.xview_scroll ( howMany, units ) elif op == moveto: self.txtLogger.xview_moveto ( howMany ) def __vsbScrollHandler(self, *L): op, howMany = L[0], L[1] if op == scroll: units = L[2] self.txtLogger.yview_scroll ( howMany, units ) elif op == moveto: self.txtLogger.yview_moveto ( howMany ) Thanks and regards, Rajat -- http://mail.python.org/mailman/listinfo/python-list
Unable to write % character to a file using writelines() method
Hi, I'm using the writelines() method to write some lines to a text file. But I'm unable to write the % character to the file using the following format: fdTolFile.writelines(\n\tdiff Not in %s '%' range %(toleranceInPer)) The second % does not get write to the file and Im getting errors. Please suggest what additional information should I give to write the % character. The errro Im getting is : File C:\Documents and Settings\\TA-workspace\src\TestAndCompareResults.py, line 840, in __parseDiffTextFile fdTolFile.writelines(\n\tdiff in %s'%' range %(toleranceInPer)) TypeError: not enough arguments for format string I've also tried this: fdTolFile.writelines(\n\tdiff Not in %s \% range %(toleranceInPer)) But still I get the same error Thanks and regards, Rajat -- http://mail.python.org/mailman/listinfo/python-list
Tkinter: scrollbar - unable to scroll the scrollbar if I click on arrow buttons of scroll bars
Hi, Im using a tkinter scrollbars for horinzontal and vertical scrolling. Well the problem is I'm unable to scroll if I click on the arrows buttons of scrollbars ( with both types of scrollbars) Please suggest if I m missing some configuration. My code is as below: self.hsb = Scrollbar(appGuiFrame, orient = HORIZONTAL) self.hsb.grid(row = 2,column = 0, sticky = E+W) #vertical scroll bar self.vsb = Scrollbar(appGuiFrame) self.vsb.grid(row = 1,column = 2, sticky = N+S) self.txtLogger = Text(appGuiFrame, \ height = 20,\ width = 100, \ state = DISABLED, \ xscrollcommand = self.hsb.set, \ yscrollcommand = self.vsb.set, \ wrap = NONE, \ font = (courier,12)) self.hsb.config(command = self.txtLogger.xview()) self.vsb.config(command = self.txtLogger.yview()) Please help. Thanks and regards, Rajat -- http://mail.python.org/mailman/listinfo/python-list
Re: Unable to write % character to a file using writelines() method
On Sun, Sep 28, 2008 at 5:51 PM, Christian Heimes [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: Hi, I'm using the writelines() method to write some lines to a text file. But I'm unable to write the % character to the file using the following format: fdTolFile.writelines(\n\tdiff Not in %s '%' range %(toleranceInPer)) Try %% :) Christian -- http://mail.python.org/mailman/listinfo/python-list Thanks Garry Christian. It worked. Regards, Rajat -- http://mail.python.org/mailman/listinfo/python-list
Regular expression help: unable to search ' # ' character in the file
Hi, Can some help me with the regular expression. I'm looking to search # character in my file? My file has contents: ### Hello World ### length = 10 breadth = 20 height = 30 ### ### Hello World ### length = 20 breadth = 30 height = 40 ### I used the following search : import re fd = open(file, 'r') line = fd.readline pat1 = re.compile(\#*) while(line): mat1 = pat1.search(line) if mat1: print line line = fd.readline() But the above prints the whole file instead of the hash lines only. Please help Regards, Rajat -- http://mail.python.org/mailman/listinfo/python-list
Re: Regular expression help: unable to search ' # ' character in the file
On Sat, Sep 27, 2008 at 1:58 PM, Fredrik Lundh [EMAIL PROTECTED]wrote: [EMAIL PROTECTED] wrote: import re fd = open(file, 'r') line = fd.readline pat1 = re.compile(\#*) while(line): mat1 = pat1.search(line) if mat1: print line line = fd.readline() I strongly doubt that this is the code you used. But the above prints the whole file instead of the hash lines only. * means zero or more matches. all lines is a file contain zero or more # characters. but using a RE is overkill in this case, of course. to check for a character or substring, use the in operator: for line in open(file): if # in line: print line /F -- http://mail.python.org/mailman/listinfo/python-list Thanks Fredrik, this works. Indeed it is a much better and cleaner approach. -- Regards, Rajat -- http://mail.python.org/mailman/listinfo/python-list
unable to parse the content using the regular expression
Hello, I've the following results from Difflib.Compare() which I want to parse them using the regular expression to find out the the values that have changed. ## Testing DLL interface ## Input File:c:\12.txt Config File:c:\abc.ini ## Results:- --- - Analysis Time (Iterations = 1) = 0.0449145s ? ^^ ^ + Analysis Time (Iterations = 1) = 0.0447347s ? ^^ ^ Width = 0.89 Height = 0.044 - Length = 10 ? ^ + Length = 11 ? ^ End of Results ## Testing DOTNET interface ## Input File:c:\12.txt Config File:c:\abc.ini ### Results:- --- - Analysis Time (Iterations = 1) = 0.0449145s ? ^^ ^ + Analysis Time (Iterations = 1) = 0.0447347s ? ^^ ^ Width = 0.89 Height = 0.044 - Length = 12 ? ^ + Length = 13 ? ^ End of Results ** How Can I extract the headings out of this file? The headings are: ## Testing DLL interface ## Input File:c:\12.txt Config File:c:\abc.ini ## Here I want to display only the values that differ i.e. the lines prceded with +,?,- signs ## Testing DOTNET interface ## Input File:c:\12.txt Config File:c:\abc.ini ### I intent to show only the things that differ with their proper headings(as above) Please help me to get the heading stuff out. Regards, Rajat -- http://mail.python.org/mailman/listinfo/python-list
Tkinter: Unable to update the text scroll
Hi, I've a Tkinter application which has some widgets and a textbox with scrollbar, I call it txtScroll. The txtScroll is used to display the processing log that application is doing. Well the problem is that the txtSxroll is not able to display the log at the time some thing is processed. Rather, it displays the log after the complete processing processing is done. Example: In a function, I've the following lines: def func(): print 'Testing Result Comp' TASymbols.objLogToGUI.outputText(Starting Test and Results Comparison\n) if selectedLib != TASymbols.strSelectAll: # we do not pass it as a string instead we will pass it in a #single element list libKey = self.__findKey(self.__libDict, selectedLib) The colored line should display the stuff at the time it appeared in the code. But only displays this after the function func() has processed completely. PS : I'm not using any threading stuff here.. Please help me resolve this problem. Regards, Rajat -- http://mail.python.org/mailman/listinfo/python-list
problem updating variable in a module
Hi, I've a problem updating my variable in a module. In my main program, I call a function from mod1 to update a variable of mod1 As soon as I update this varibale, I check it back in the mail program but it the variable from mod1 does not get updated. main Program: import mod1 a = 20 mod.update(a) print mod.a does not print anything mod1 a = 10 def update(someInt): global a a = someInt print a this does actually print a = 20 Please help. Regards, Rajat -- http://mail.python.org/mailman/listinfo/python-list
Re: problem updating variable in a module
Thanks Tim, Yes, I mean 'mod' only. But this does not work for me On Wed, Sep 24, 2008 at 4:19 PM, Tim Rowe [EMAIL PROTECTED] wrote: 2008/9/24 [EMAIL PROTECTED]: Hi, I've a problem updating my variable in a module. In my main program, I call a function from mod1 to update a variable of mod1 As soon as I update this varibale, I check it back in the mail program but it the variable from mod1 does not get updated. main Program: import mod1 a = 20 mod.update(a) print mod.a does not print anything mod1 a = 10 def update(someInt): global a a = someInt print a this does actually print a = 20 I'm surprised it runs at all -- as far as I can see mod in mod.update(a) and print mod.a is not defined. Did you mean mod1? If I change it to that, both print statements print 20 as I'd expect. I take it you do have a *really* good reason to use a global? -- Tim Rowe -- http://mail.python.org/mailman/listinfo/python-list -- Regrads, Rajat -- http://mail.python.org/mailman/listinfo/python-list
Re: problem updating variable in a module
I take it you do have a *really* good reason to use a global? Please suggest some way other than using global. I want to get rid of it -- Regards, Rajat -- http://mail.python.org/mailman/listinfo/python-list
Looking for a Duo - file comparison and a file parser
HI, I'm thinking of writing a file comparison utility in python. This utility will work as: 1. Compare 2 files for the differences. Both files contain some numerical results. 2. Generate a common file containing the differences (the same way as 'diff' generate an output) 3. Now, I will parse this file containing differences to check as to how much is the difference of one file from other. So, for this I hope a parser will be required. Is there a utility available that performs similar job ( that some one might have created considering the huge number of users of python) ? Or may be some one has written some parser? Any help is greatly appreciated. Thanks and regards, Rajat -- http://mail.python.org/mailman/listinfo/python-list
Unable to start a process with subprocess Popen()
Hi, I'm using the subprocess module's Popen() to start a batch file. This batch file basically calls an exe which also gets started. Unfortunately, this does not produce any results. I looked into the Task bar that this exe has started but it does not consume and cpu so I believet that this exe is not working. I used the following command to start the batch fiile: testing = subprocess.Popen([batchFilePath], \ shell = True, \ stdout = subprocess.PIPE, \ stderr = subprocess.PIPE).communicate()[0] batchFilePath is the path of the batch file. -- Regrads, Rajat -- http://mail.python.org/mailman/listinfo/python-list
Re: Unable to start a process with subprocess Popen()
On Mon, Sep 8, 2008 at 11:50 AM, [EMAIL PROTECTED] wrote: Hi, I'm using the subprocess module's Popen() to start a batch file. This batch file basically calls an exe which also gets started. Unfortunately, this does not produce any results. I looked into the Task bar that this exe has started but it does not consume and cpu so I believet that this exe is not working. I used the following command to start the batch fiile: testing = subprocess.Popen([batchFilePath], \ shell = True, \ stdout = subprocess.PIPE, \ stderr = subprocess.PIPE).communicate()[0] batchFilePath is the path of the batch file. -- Regrads, Rajat Ok, I re-phrase my question: there is a batch file that executes a exe file. The batch just works if run from command prompt and produces output to standard output and the file. Now, I try to call the same batch file from subprocess.Pope() call. The batch file gets called and that internally also calls the exe file. But, the exe just runs forever i.e. hangs and does not produces output , atleast not to the file. Please suggest is there is something wrong with the above code. Regards, Rajat -- http://mail.python.org/mailman/listinfo/python-list
Re: Unable to start a process with subprocess Popen()
On Mon, Sep 8, 2008 at 4:43 PM, aha [EMAIL PROTECTED] wrote: On Sep 8, 7:23 am, [EMAIL PROTECTED] wrote: On Mon, Sep 8, 2008 at 11:50 AM, [EMAIL PROTECTED] wrote: Hi, I'm using the subprocess module's Popen() to start a batch file. This batch file basically calls an exe which also gets started. Unfortunately, this does not produce any results. I looked into the Task bar that this exe has started but it does not consume and cpu so I believet that this exe is not working. I used the following command to start the batch fiile: testing = subprocess.Popen([batchFilePath], \ shell = True, \ stdout = subprocess.PIPE, \ stderr = subprocess.PIPE).communicate()[0] batchFilePath is the path of the batch file. -- Regrads, Rajat Ok, I re-phrase my question: there is a batch file that executes a exe file. The batch just works if run from command prompt and produces output to standard output and the file. Now, I try to call the same batch file from subprocess.Pope() call. The batch file gets called and that internally also calls the exe file. But, the exe just runs forever i.e. hangs and does not produces output , atleast not to the file. Please suggest is there is something wrong with the above code. Regards, Rajat Hello Rajat, I would take a look at the thread below, it might help it might not: http://groups.google.com/group/comp.lang.python/browse_thread/thread/4505613f014fdec7/3ee15c9c88a5efdc?hl=en#3ee15c9c88a5efdc Also, if you post a larger section of the code I might be able to give you a hand. Once you've run the testing = subprocess.Popen() make sure you use a testing.wait() -- http://mail.python.org/mailman/listinfo/python-list Hi Aaquil, Thanks for helping me out with this piece of information. My Original code is : testing = subprocess.Popen([batchFilePath], \ shell = True, \ stdout = subprocess.PIPE, \ stderr = subprocess.PIPE) result = testing.wait() if result 0: childError = testing.stderr.read() tkMessageBox._show(Error, \ icon='error', \ message =Error: %s % childError) return None else: print result My child process was unresponsive. Later I got to know with the below code that there were some errors coming from the child process which I was not able to detect with this code. I googled for some solution and found the below code :- print ttt, batchFilePath #print os.listdir(batchFilePath) try: cmd = subprocess.Popen([batchFilePath], \ shell = True, \ stdin = subprocess.PIPE, stdout = subprocess.PIPE, \ stderr = subprocess.PIPE \ ) cmd.stdin.close() outPipe, errPipe = PipeThread(cmd.stdout), PipeThread(cmd.stderr) outPipe.run(), errPipe.run() retcode = cmd.wait() out, err = outPipe.getOutput(), errPipe.getOutput() if retcode != 0 and err != '': raise ExecutionFailed, os.path.basename(batchFilePath) + exited with error code + str(retcode) + and errors:\n + err elif retcode != 0: raise ExecutionFailed, os.path.basename(batchFilePath) + exited with error code + str(retcode) + and output:\n + out elif err != '': return out + \n + os.path.basename(batchFilePath) + gave warnings:\n + err else: return out except Exception, e: if isinstance(e, ExecutionFailed): raise else: raise ExecutionFailed, Error while executing + :\n + str(e) Here are the Exception and the PipeThread Classes: class PipeThread(threading.Thread): def __init__(self, fin): self.fin = fin self.sout = threading.Thread.__init__(self) def run(self): self.sout = self.fin.read() def getOutput(self): return self.sout class ExecutionFailed(Exception): def __init__(self, value): self.parameter = value def __str__(self): return str(self.parameter) Although, this solved my problem. But I know there is no need for using threading in this problem. This problem could've been solved just by the subprocess module. I'm unnecessarily using the threading module. Regards, Rajat -- Regrads, Rajat -- http://mail.python.org/mailman/listinfo/python-list
How to bring subprocess to the foreground?
Hi, I've a batch file that I open with the subprocess .Popen() . When this batch file is run I want to bring it to the foreground. Please suggest how can I do this? Regards, Rajat -- http://mail.python.org/mailman/listinfo/python-list
Re: How to bring subprocess to the foreground?
On Sat, Sep 6, 2008 at 3:13 PM, Diez B. Roggisch [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] schrieb: Hi, I've a batch file that I open with the subprocess .Popen() . When this batch file is run I want to bring it to the foreground. Please suggest how can I do this? You can't. You can capture the stdout using the pipe-arguments, and in your main-process, read that and write it to the main process' stdout. Diez -- http://mail.python.org/mailman/listinfo/python-list Hi Diez, Thanks for the information. That's valuable information. I though of displayin an information message on the screen through tkMessageBox while the subprocess is running, I did it using: try: testing = subprocess.Popen([batchFilePath], \ shell = True) retCode = testing.wait() tkMessageBox._show(Test Harness execution, \ icon = 'info', \ message=Testing %s in progress... % libName) except: tkMessageBox._show(Error, \ type='ok', icon='error', \ message=Error executing %s Test Harness % libName) return None else: print retCode But the message is never displayed. Please suggest if there is something wrong with this code -- Regards, Rajat -- http://mail.python.org/mailman/listinfo/python-list
Want to display a message box while subprocess is running
Hi, I m using subprocess module and using the Popen call. While the subprocess if running, I want to display a tkMessageBox(). Does some one has a sample code for this? Thanks and regards, Rajat -- http://mail.python.org/mailman/listinfo/python-list
Re: How to bring subprocess to the foreground?
On Sat, Sep 6, 2008 at 6:53 PM, Paul Boddie [EMAIL PROTECTED] wrote: On 6 Sep, 17:58, [EMAIL PROTECTED] wrote: I though of displayin an information message on the screen through tkMessageBox while the subprocess is running, I did it using: try: testing = subprocess.Popen([batchFilePath], \ shell = True) retCode = testing.wait() Note that you wait for the process to finish here... tkMessageBox._show(Test Harness execution, \ icon = 'info', \ message=Testing %s in progress... % libName) ...and that you show a message about the process running *after* waiting until it isn't running any more. except: tkMessageBox._show(Error, \ type='ok', icon='error', \ message=Error executing %s Test Harness % libName) return None else: print retCode But the message is never displayed. Please suggest if there is something wrong with this code I think you should first show your message, *then* wait for the process to finish. Paul -- http://mail.python.org/mailman/listinfo/python-list Such a silly mistake I'm committing. Thanks a ton. -- Regrads, Rajat -- http://mail.python.org/mailman/listinfo/python-list
Looking for File comparison utility that produces actual differences
Hi, I looking for a file comparison utility in Python that works like 'diff' command in Unix and 'comp' in Windows. The present 'cmd' in filecmp module only presents output in the form of 1 or 0 i.e whether the 2 files differ or not? So, I'm lookin for something that generates actual differences and moreover it is cross platform as well. As I need that same thing in both my windows and linux box. Even if it is a utlility please suggest. Thanks and regards, Rajat -- http://mail.python.org/mailman/listinfo/python-list
What is module initialization?
Hi, I found on the net that there is something called module initialization. Unfortunately, there is not much information for this. However, small the information I found module initialization can be of use to me in my project. I'm currently messing with a problem where I'm keeping my global variables ( or symbols) in a module and the other mdoules in the project acess these global variables. However, there is one case when a module updates one such global variable but the variable is not getting updated in the module containing global symbols ( variables). This happen only at the start of the program and at rest of the places in the program that global variable is not accessed. So, I thought of using this module initialization where I will intialize the module only once to update that variable. Ans in the rest of the program where ever this module is imported I shall be able to easily access the update value of the variable. Could some one provide me a sample code of module intialization? And how can I ensure that module initialization is done only once? Thanks and regards, Rajat -- http://mail.python.org/mailman/listinfo/python-list
Re: What is module initialization?
While this is technically legal, you should restrain yourself from doing such a thing, unless you *really* know what you're doing and why. but the variable is not getting updated in the module containing global symbols ( variables). I suspect you didn't use a qualified name when importing. You have to do it this way : # myglobals.py: answer = 42 # question.py import myglobals myglobals.answer = WTF ? But if I do :- #question.py from myglobals import * myglobals.answer = WTF ? will this work? -- http://mail.python.org/mailman/listinfo/python-list
Re: What is module initialization?
On Tue, Sep 2, 2008 at 6:22 PM, Fredrik Lundh [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: # myglobals.py: answer = 42 # question.py import myglobals myglobals.answer = WTF ? But if I do :- #question.py from myglobals import * myglobals.answer = WTF ? will this work? with the above definition of myglobals, no. from myglobals import doesn't add the module object to the importing module's namespace. have you read: http://effbot.org/zone/import-confusion.htm ? /F -- http://mail.python.org/mailman/listinfo/python-list Thanks for your help guys that I got my problem resolved. Regards, Rajat -- http://mail.python.org/mailman/listinfo/python-list
Unable to clear Entry subwidget of Tix Combo Box
Hi, In my combo box taken from Tix, how can I clear the entry subwidget? My case is like this: I have a check button which when made un-ticked should clear the entry from combo box (i. anything selected in combo box previously) I used the following commands: subEntry = self.cbAnalysisLibVersion.subwidget(entry) subEntry.delete(0,END) But this is not working. Please help. Thanks and regards, Rajat -- http://mail.python.org/mailman/listinfo/python-list
TkMessageBox - Using sys.exit() is a a great pain. Looking for other similar commands.
Hi, I'm using a TkMessageBox for handling some errors and displaying them through the message boxes. My code is as below: if selectedVer == strNoArchivedResults: tkMessageBox._show(Error, \ type='ok', icon='error', \ message=Cannot perform Results Comparison as no results are currently archived for this library) sys.exit() This message box is displayed when the above comdition is met: Using sys.exit() is a great pain since this closes my parent GUI ( the main GUI). Please suggest some other way around. Thanks and regards, Rajat -- http://mail.python.org/mailman/listinfo/python-list
How to delete elements from Tix Combo Box?
HI, I'm using a Tix combo box (I call it combo2), the contents of which are loaded depeding on the selection in another Tix combo box(I call it combo1) I have used the commands: self.cbAnalysisLibVersion.insert(END, results) to insert elements to the combo box. I'm looking for some similar option to delete elements from the combo box. I mean, as soon as I change selection in combo1 the previous elements in the combo2 should get cleared up( or deleted) and | shall be able to the above insert command to add new elements to the combo2 ( depending upon selection in combo1) Please suggest how can I clear up the ( delete the entries) in combo2. Thanks and regards, Rajat -- http://mail.python.org/mailman/listinfo/python-list
Re: How to delete elements from Tix Combo Box?
On Sat, Aug 30, 2008 at 2:32 PM, Fredrik Lundh [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: I'm using a Tix combo box (I call it combo2), the contents of which are loaded depeding on the selection in another Tix combo box(I call it combo1) I have used the commands: self.cbAnalysisLibVersion.insert(END, results) to insert elements to the combo box. I'm looking for some similar option to delete elements from the combo box. I mean, as soon as I change selection in combo1 the previous elements in the combo2 should get cleared up( or deleted) and | shall be able to the above insert command to add new elements to the combo2 ( depending upon selection in combo1) Please suggest how can I clear up the ( delete the entries) in combo2. no time to test this, but iirc, the combobox content is held in an ordinary listbox widget, so you should be able to use the subwidget method to fetch that widget, and then use ordinary listbox methods to change the content. Something like this: lb = w.subwidget(listbox) lb.delete(0, END) # delete all items /F -- http://mail.python.org/mailman/listinfo/python-list Fredrik, Thanks so much. That worked. Following this, I can now see that my combo2 has no previous elements and contains only the elements relevant to selection in combo1. Now, as soon as I select something in combo 2 and go back to change selection in combo1 the combo2 must get its history cleared up (i.e the previous selection in combo2's entry subwidget) I used the command before I delete the entires : self.combo2.config(history = False) But this does not seem to be working; Here is my code snippet: Inside the callback function of combo1: for libName, libResults in self.__libVerDict.items(): if libName == selectedLibName: #Get the list of labelled results resultsVer = self.__libVerDict[libName] self.combo2.config(state = NORMAL) self.combo2.config(history = False) #Delete the previous entries from the listbox #subwidget of combo box subLB = self.combo2.subwidget(listbox) subLB.delete(0, END) #Add the results to the combo box for results in resultsVer: self.combo2.insert(END, results) -- Regards, Rajat -- http://mail.python.org/mailman/listinfo/python-list
How to clear the Entry subwidget of Tix Combo box?
Hi, In my combo box taken from Tix, how can I delete item in Entry subwiget? My case is like this: I have a check button which when made un-ticked should clear the entry from combo box (i. anything selected in combo box previously) I used the following commands: subEntry = self.cbAnalysisLibVersion.subwidget(entry) subEntry.delete(0,END) This does not seem to be working? -- Regrads, Rajat -- http://mail.python.org/mailman/listinfo/python-list
problem with execv command
Hi, I'm facing problem with the execv command: my command is : os.execv(' C:\Program Files\Subversion\bin\svn ', ( 'list', ' \ http://subversion.stv.abc.com/svn/Eng \ ' ) ) The error I'm getting is : OSError: [Errno 22] Invalid argument I tried using a variable for http path but still I'm getting the same error Please help. -- Regards, Rajat -- http://mail.python.org/mailman/listinfo/python-list
Re: Tkinter tkMessageBox problem - message box is displayed with an additional window
On Thu, Aug 28, 2008 at 3:54 PM, Guilherme Polo [EMAIL PROTECTED] wrote: On Thu, Aug 28, 2008 at 10:29 AM, [EMAIL PROTECTED] wrote: Hi, I'm working on Windows Platform I'm facing some problem with the tkMessageBox. My code is as below: import tkMessageBox import Tix from Tkinter import * if len(installedLibPath) != len(listOfLibraries): if tkMessageBox.askyesno(Question, \ type='yesno', icon='warning', \ message=Some of the libraries are not installed. Do you wish to continue with the remaining?): myRoot = Tix.Tk() myAppGUIObject = myAppGUI(myRoot)#Class for my GUI myRoot.mainloop() else: sys.exit(0) It is good to post a short code sample that demonstrates the problem, but it has to run by itself at least. The Message Box is called before the Tix.Tk mainloop(). The problems are as under : 1. Since the message box is displayed before the mainloop() is started, the message box is displayed with another window that is blank. This should not be displayed. 2. As a results of this messagebox (called before the mainloop) the original Gui started by mainloop doesnot work as desired. Some of the checkbuttons are displayed as unset (i.e un-ticked). These checkbuttons used to be set at initialization before I stared using this messagebox. tkMessageBox blocks till you finish it, maybe that is what is causing your problem but it is hard to tell what you are doing wrong in that myAppGui without seeing it (preferably reduced code demonstrating the problem). Now.. an attempt to solve your problem. Tk always has a root window going on, so that another window is inevitable, but you can hide and show it again when needed. You could do something like this: import tkMessageBox import Tkinter class App(object): def __init__(self, master): self.master = master print tkMessageBox is gone now root = Tkinter.Tk() root.withdraw() tkMessageBox.askyesno(Question, message=Do you use Python?, type='yesno', icon='warning', master=root) root.deiconify() app = App(root) root.mainloop() Please help. Thanks and regards, Rajat -- Regrads, Rajat -- http://mail.python.org/mailman/listinfo/python-list -- -- Guilherme H. Polo Goncalves Thanks Guilherme, your suggestion helped solve the problem. -- Regards, Rajat -- http://mail.python.org/mailman/listinfo/python-list
How to check is something is a list or a dictionary or a string?
Hi, How to check if something is a list or a dictionary or just a string? Eg: for item in self.__libVerDict.itervalues(): self.cbAnalysisLibVersion(END, item) where __libVerDict is a dictionary that holds values as strings or lists. So now, when I iterate this dictionary I want to check whether the item is a list or just a string? Thanks, Rajat -- http://mail.python.org/mailman/listinfo/python-list
How to delete a ast character from a string?
Hi, I've a list some of whose elements with character \. I want to delete this last character from the elements that have this character set at their end, I have written a small program, unfortunately this does not work: dirListFinal = [] for item in dirList: print item if item.endswith('\\') == True: item = item[0:-1] # This one I googled and found to remove the last character / dirListFinal.append(item) else: dirListFinal.append(item) item.endswith() does not seem to be working. Please help -- Regrads, Rajat -- http://mail.python.org/mailman/listinfo/python-list
How to delete a last character from a string
Sorry : Earlier mail had a typo in Subject line which might look in-appropriate to my friends Hi, I've a list some of whose elements with character \. I want to delete this last character from the elements that have this character set at their end, I have written a small program, unfortunately this does not work: dirListFinal = [] for item in dirList: print item if item.endswith('\\') == True: item = item[0:-1] # This one I googled and found to remove the last character / dirListFinal.append(item) else: dirListFinal.append(item) item.endswith() does not seem to be working. Please help -- Regrads, Rajat -- http://mail.python.org/mailman/listinfo/python-list
Re: How to delete a ast character from a string?
On Fri, Aug 29, 2008 at 7:40 PM, Chris Rebert [EMAIL PROTECTED] wrote: On Fri, Aug 29, 2008 at 11:25 AM, [EMAIL PROTECTED] wrote: Hi, I've a list some of whose elements with character \. I want to delete this last character from the elements that have this character set at their end, I have written a small program, unfortunately this does not work: dirListFinal = [] for item in dirList: print item if item.endswith('\\') == True: You san simplify that line to just: if item.endswith('\\'): item = item[0:-1] # This one I googled and found to remove the last character / And you don't need the leading 0, so just use: item = item[:-1] dirListFinal.append(item) else: dirListFinal.append(item) And those last 3 lines are a bit redundant. Just put one dirListFinal.append(item) at the same indentation level as the if and delete those 3 lines. Not that these changes will necessarily fix your program, but they do make it easier to comprehend for the reader. - Chris item.endswith() does not seem to be working. Please help -- Regrads, Rajat -- http://mail.python.org/mailman/listinfo/python-list Thanks for the suggestions. I wondered if the item is really a string. So I added the following to check this: item = for item in dirList: print type(item) if item.endswith('\\'): item = item[:-1] dirListFinal.append(item) Though item.endswith() is not workin still. The type of item is appearing to be type 'str' So this confirms this is a string. But why the string operation endswith() is not working. Really strange. -- http://mail.python.org/mailman/listinfo/python-list
Re: How to delete a last character from a string
On Fri, Aug 29, 2008 at 7:41 PM, Mike Driscoll [EMAIL PROTECTED] wrote: On Aug 29, 1:28 pm, [EMAIL PROTECTED] wrote: Sorry : Earlier mail had a typo in Subject line which might look in-appropriate to my friends Hi, I've a list some of whose elements with character \. I want to delete this last character from the elements that have this character set at their end, I have written a small program, unfortunately this does not work: dirListFinal = [] for item in dirList: print item if item.endswith('\\') == True: item = item[0:-1] # This one I googled and found to remove the last character / dirListFinal.append(item) else: dirListFinal.append(item) item.endswith() does not seem to be working. Please help -- Regrads, Rajat Try something like this: x = 'test\\' if x.endswith('\\'): x = x[:-1] This works with Python 2.5.2 on Windows XP. Mike -- http://mail.python.org/mailman/listinfo/python-list There is just a single \ at the end of every item. My list is as below: ['Results v1.0/', 'Results v1.1/'] so, if x.endswith('\\'): is that correct? -- http://mail.python.org/mailman/listinfo/python-list
Re: How to delete a last character from a string
On Fri, Aug 29, 2008 at 7:59 PM, [EMAIL PROTECTED] wrote: On Fri, Aug 29, 2008 at 7:41 PM, Mike Driscoll [EMAIL PROTECTED] wrote: On Aug 29, 1:28 pm, [EMAIL PROTECTED] wrote: Sorry : Earlier mail had a typo in Subject line which might look in-appropriate to my friends Hi, I've a list some of whose elements with character \. I want to delete this last character from the elements that have this character set at their end, I have written a small program, unfortunately this does not work: dirListFinal = [] for item in dirList: print item if item.endswith('\\') == True: item = item[0:-1] # This one I googled and found to remove the last character / dirListFinal.append(item) else: dirListFinal.append(item) item.endswith() does not seem to be working. Please help -- Regrads, Rajat Try something like this: x = 'test\\' if x.endswith('\\'): x = x[:-1] This works with Python 2.5.2 on Windows XP. Mike -- http://mail.python.org/mailman/listinfo/python-list There is just a single \ at the end of every item. My list is as below: ['Results v1.0/', 'Results v1.1/'] so, if x.endswith('\\'): is that correct? Sorry Guys. I did rubbish here and bothered you guys. I did not recognize that I need to check for / character and not \ Really very sorry. Working for the last 14 hrs, could not see this properly. Its time I must go home and take rest. Regards, Rajat -- http://mail.python.org/mailman/listinfo/python-list
Re: How to delete a last character from a string
On Fri, Aug 29, 2008 at 8:37 PM, Steven D'Aprano [EMAIL PROTECTED] wrote: On Fri, 29 Aug 2008 14:46:53 -0400, Derek Martin wrote: On Fri, Aug 29, 2008 at 07:28:40PM +0100, [EMAIL PROTECTED] wrote: dirListFinal = [] for item in dirList: print item if item.endswith('\\') == True: if item[-1] == '\\': Which will fail badly if item is the empty string. Rajat, rather than trying to invent your own code to join directory paths, you should use the os.path module: import os os.path.join('/dir', 'x', 'y', 'z', 'file.txt') '/dir/x/y/z/file.txt' os.path.split('/a/b/c/d/file.txt') ('/a/b/c/d', 'file.txt') -- Steven -- http://mail.python.org/mailman/listinfo/python-list Steven, Thanks so much. I just found out that I unknowingly searching for something else i.e. / rather than \ Just corrected this mistake and fixed it. -- Regrads, Rajat -- http://mail.python.org/mailman/listinfo/python-list
Re: Ctypes module - looking for a way to dynamically call exported function from a set of dlls
On Wed, Aug 27, 2008 at 5:20 AM, Gabriel Genellina [EMAIL PROTECTED] wrote: En Tue, 26 Aug 2008 07:42:50 -0300, [EMAIL PROTECTED] escribi�: Hi, I'm using the ctypes module to load my dlls. I have some 10 dlls the names of those are passed to a fucntion which then loads the passed dll. Now every dll has a getversion function. eg: A.dll, B.dll, C.dll are the dlls and GetVersion functions are as: A_getVersion(), B_getVersion(), C_getVesion() The functionality I'm lookking for is that depending on the dll passed the right getVersion should be passed. I'm able to load the all the dlls passed to the function but I'm not able to call the function names dynamically Use getattr - same as with any other object. Suppose some_dll is your loaded DLL, then: function = getattr(some_dll, function_name) -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list Hi Gabriel, Thanks for the help. That solved my problem. -- Regards, Rajat -- http://mail.python.org/mailman/listinfo/python-list
Tkinter tkMessageBox problem - message box is displayed with an additional window
Hi, I'm working on Windows Platform I'm facing some problem with the tkMessageBox. My code is as below: import tkMessageBox import Tix from Tkinter import * if len(installedLibPath) != len(listOfLibraries): if tkMessageBox.askyesno(Question, \ type='yesno', icon='warning', \ message=Some of the libraries are not installed. Do you wish to continue with the remaining?): myRoot = Tix.Tk() myAppGUIObject = myAppGUI(myRoot)#Class for my GUI myRoot.mainloop() else: sys.exit(0) The Message Box is called before the Tix.Tk mainloop(). The problems are as under : 1. Since the message box is displayed before the mainloop() is started, the message box is displayed with another window that is blank. This should not be displayed. 2. As a results of this messagebox (called before the mainloop) the original Gui started by mainloop doesnot work as desired. Some of the checkbuttons are displayed as unset (i.e un-ticked). These checkbuttons used to be set at initialization before I stared using this messagebox. Please help. Thanks and regards, Rajat -- Regrads, Rajat -- http://mail.python.org/mailman/listinfo/python-list
How to bind an event in Tix combo box?
Hi, I'm a newbie and created a new combo box with Tix. The combo box is filled with the required items. I've used Tkinter's listbox and used the ListboxSelect event and bind that with a callback. Now, I want to do the same stuff with the Tix combo box. Please suggest how can I do the same in Tix combo box. Thanks and regards, Rajat -- http://mail.python.org/mailman/listinfo/python-list
Ctypes module - looking for a way to dynamically call exported function from a set of dlls
Hi, I'm using the ctypes module to load my dlls. I have some 10 dlls the names of those are passed to a fucntion which then loads the passed dll. Now every dll has a getversion function. eg: A.dll, B.dll, C.dll are the dlls and GetVersion functions are as: A_getVersion(), B_getVersion(), C_getVesion() The functionality I'm lookking for is that depending on the dll passed the right getVersion should be passed. I'm able to load the all the dlls passed to the function but I'm not able to call the function names dynamically Please help Regards, Rajat -- http://mail.python.org/mailman/listinfo/python-list
Tkinter - How to create combo box using Tix with the existing Tkinter widgets/
Hi, I'm using Tkinter module to create a GUI application. I found that the combo box is not present in Tkinter module. It comes with Tix module. Could some one give me an example to create a combo box whilst using Tix and Tkinter? I've been using the following to create my tkinter widgets: myRoot = Tk() and in my Gui code, I've been using self.lbAnalysisLib = Listbox(master, \ yscrollcommand = self.vsbAnalysisLib.set,\ height = 1, width = 30) Please suggest how could I call the Tix's combo box from my existing GUI application that heavily uses the Tkinter widgets? Kindly provide me some code examples. Thanks and regards, Rajat -- http://mail.python.org/mailman/listinfo/python-list
Re: Tkinter - How to create combo box using Tix with the existing Tkinter widgets/
On Mon, Aug 25, 2008 at 12:57 PM, [EMAIL PROTECTED] wrote: Hi, I'm using Tkinter module to create a GUI application. I found that the combo box is not present in Tkinter module. It comes with Tix module. Could some one give me an example to create a combo box whilst using Tix and Tkinter? I've been using the following to create my tkinter widgets: myRoot = Tk() and in my Gui code, I've been using self.lbAnalysisLib = Listbox(master, \ yscrollcommand = self.vsbAnalysisLib.set,\ height = 1, width = 30) Please suggest how could I call the Tix's combo box from my existing GUI application that heavily uses the Tkinter widgets? Kindly provide me some code examples. Thanks and regards, Rajat Ok...now I found the way to do that. But I'm stuck further. my code is as below: main module ** myRoot = Tix.Tk() myAppGUIObject = myAppGUI(myRoot) Gui module class myAppGUI: def __init__(self, master): self.cbAnalysisLib = Tix.ComboBox(master, label = Analysis Library:) self.cbAnalysisLib.grid(row = 3, column = 1, padx = 30, pady = 30, sticky = W) self.cbAnalysisLib.config(editable = 0) self.cbAnalysisLibVersion = Tix.ComboBox(master, label = Reference Analysis Library Version:, \ labelside = 'left') self.cbAnalysisLibVersion.grid(row = 5, column = 1, padx = 30, pady = 30, sticky = W) self.cbAnalysisLibVersion.config(editable = 0) The problem is that the labelside option is not working. I'm not able to use even the wraptext option. -- Regrads, Rajat -- http://mail.python.org/mailman/listinfo/python-list
windows / Tkinter - Tix - combo box - how to bind function to an event
Hi, I'm using Tkinter and Tix. I've created a combo box which I am able to fill it up. I'm want to call a function as soon as user selects some thing from the combo box. More precisely, I want to know how can i bind my function to this selection event. What this event is technically called? Please suggest how can I do this? -- Regrads, Rajat -- http://mail.python.org/mailman/listinfo/python-list
Re: WindowsXP/ CTypes - How to convert ctypes array to a string?
On Tue, Aug 19, 2008 at 8:14 AM, Fredrik Lundh [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: I also add the letter 'v' same as you suggested. However, I'm looking to store this into some variable ( that variable could be be a string, tuple or anything, Im not sure which is the suited one) the expression gives you a string object; you'll store it in a variable in the same way as you'd store any other expression result in Python. version = v%d.%d.%d.%d % tuple(version) but when you find yourself getting stuck on things like this, it might a good idea to take a step back and read the tutorial again: http://docs.python.org/tut/tut.html pay special attention to the parts that discuss how variables work in Python. if you prefer some other entry level tutorial, the following is said to be really good: http://www.ibiblio.org/g2swap/byteofpython/read/ /F -- http://mail.python.org/mailman/listinfo/python-list Thanks Fredrik for your support. Regrads, Rajat -- http://mail.python.org/mailman/listinfo/python-list
Tkinter/WindowsXP - how to use checkbutton to toggle a label in GUI?
Hi, I've a checkbutton in my GUI application which I want to work as: 1. it should be un-ticked by default, 2. should display a label in Gui, by default, 3. when user ticks the check button this should the above label goes off the screen and not longer is displayed. Please suggest how could I do this: my code for the check button and label is : #Check button varTestAll = IntVar() self.cbTestAll = Checkbutton(master, text=Test All, variable=varTestAll ) self.cbTestAll.grid(row = 12, column = 1, sticky = W, pady = 30, padx = 30) #Label - Version under Test self.lblVersionUnderTest = Label(master, \ text = v2.1.5.0) self.lblVersionUnderTest.grid(row = 15, \ column = 2, \ sticky = W, \ padx = 30) Please suggest. Thanks, Rajat -- http://mail.python.org/mailman/listinfo/python-list
WindowsXP / CTypes Module - unable to access function in a dll
Hi, I'm using the CTYPES module of python to load a dll. My dll contains a Get_Version function as: long __stdcall af1xEvdoRDll_GetVersion(long version[4]); This function accepts a long array of 4 elements. Following is the python code I've written: from ctypes import * abc = windll.af1xEvdoRDll GetVersion = abc.af1xEvdoRDll_GetVersion print GetVersion versionArr = c_long * 4#array of 4 longs version = versionArr(0, 0, 0, 0) # initializing all elements to 0 GetVersion(version)#calling dll function print version I'm getting the following output: _FuncPtr object at 0x00A1EB70 __main__.c_long_Array_4 object at 0x00A86300 But I'm not getting the desired output which I expect as : 2.1.5.0 Please suggest what am I missig? -- http://mail.python.org/mailman/listinfo/python-list
Re: WindowsXP / CTypes Module - unable to access function in a dll
On Tue, Aug 19, 2008 at 11:04 AM, [EMAIL PROTECTED] wrote: Hi, I'm using the CTYPES module of python to load a dll. My dll contains a Get_Version function as: long __stdcall af1xEvdoRDll_GetVersion(long version[4]); This function accepts a long array of 4 elements. Following is the python code I've written: from ctypes import * abc = windll.af1xEvdoRDll GetVersion = abc.af1xEvdoRDll_GetVersion print GetVersion versionArr = c_long * 4#array of 4 longs version = versionArr(0, 0, 0, 0) # initializing all elements to 0 GetVersion(version)#calling dll function print version I'm getting the following output: _FuncPtr object at 0x00A1EB70 __main__.c_long_Array_4 object at 0x00A86300 But I'm not getting the desired output which I expect as : 2.1.5.0 Please suggest what am I missig? Sorry, the problem is resolved. The code in fact is correct and I got the right answers. It is just that I was not priting results in a right manner. I added : print i in version : print i this solved my problem. Cheers. -- http://mail.python.org/mailman/listinfo/python-list
WindowsXP/ CTypes - How to convert ctypes array to a string?
Hi, I've used CTYPES module to access a function from a dll. This function provides me the version of the dll. This information is accessible to me as an array of 4 long inetegers. information as : 2, 1, 5, 0 I want to display these elements concatenated as v2.1.5.0. This string ( I'm thinking of writing the above 4 array elements to a string) is to be displayed as label in a GUI ( the GUI used is Tk) Please suggest how can I write these elements to a string to get me the desired results as v2.1.5.0. And, is writing to a string is right way? PS: this string also needs to be displayed in the GUI label well. FYI, the code written to access function from dll is as under: from ctypes import * abc = windll.af1xEvdoRDll GetVersion = abc.af1xEvdoRDll_GetVersion print GetVersion versionArr = c_long * 4 version = versionArr(0, 0, 0, 0) GetVersion(version) print version for i in version: print i * Results are : 2, 1, 5, 0 Cheers, Rajat -- http://mail.python.org/mailman/listinfo/python-list
Re: WindowsXP/ CTypes - How to convert ctypes array to a string?
On Tue, Aug 19, 2008 at 12:20 PM, Fredrik Lundh [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: I've used CTYPES module to access a function from a dll. This function provides me the version of the dll. This information is accessible to me as an array of 4 long inetegers. information as : 2, 1, 5, 0 I want to display these elements concatenated as v2.1.5.0. This string ( I'm thinking of writing the above 4 array elements to a string) is to be displayed as label in a GUI ( the GUI used is Tk) Please suggest how can I write these elements to a string to get me the desired results as v2.1.5.0. And, is writing to a string is right way? any special reason why you're not reading replies to your previous post? here's what I wrote last time. expecting that Python/ctypes should be able to figure out that you want an array of 4 integers printed as a dot-separated string is a bit optimistic, perhaps. but nothing that a little explicit string formatting cannot fix: from ctypes import * versionArr = c_long * 4 version = versionArr(1, 2, 3, 4) %d.%d.%d.%d % tuple(version) '1.2.3.4' inserting a v in the format string gives you the required result: v%d.%d.%d.%d % tuple(version) 'v1.2.3.4' /F -- http://mail.python.org/mailman/listinfo/python-list Fredrik, My apology for any confusion created. I read all the replies. In fact I'm thankful to you all guys who are responding so quickly to all questions. I also add the letter 'v' same as you suggested. However, I'm looking to store this into some variable ( that variable could be be a string, tuple or anything, Im not sure which is the suited one) so that I can access it in some other module that will then display this version information in a Label Widet in GUI. So, what is the best way to store 'v1.2.3.4' in a variable? And, what type of variable is most suited (so as able to be used in other module probably, as string there)? Thanks, Rajat -- http://mail.python.org/mailman/listinfo/python-list
Re: WindowsXP/ CTypes - How to convert ctypes array to a string?
On Tue, Aug 19, 2008 at 12:40 PM, [EMAIL PROTECTED] wrote: On Tue, Aug 19, 2008 at 12:20 PM, Fredrik Lundh [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: I've used CTYPES module to access a function from a dll. This function provides me the version of the dll. This information is accessible to me as an array of 4 long inetegers. information as : 2, 1, 5, 0 I want to display these elements concatenated as v2.1.5.0. This string ( I'm thinking of writing the above 4 array elements to a string) is to be displayed as label in a GUI ( the GUI used is Tk) Please suggest how can I write these elements to a string to get me the desired results as v2.1.5.0. And, is writing to a string is right way? any special reason why you're not reading replies to your previous post? here's what I wrote last time. expecting that Python/ctypes should be able to figure out that you want an array of 4 integers printed as a dot-separated string is a bit optimistic, perhaps. but nothing that a little explicit string formatting cannot fix: from ctypes import * versionArr = c_long * 4 version = versionArr(1, 2, 3, 4) %d.%d.%d.%d % tuple(version) '1.2.3.4' inserting a v in the format string gives you the required result: v%d.%d.%d.%d % tuple(version) 'v1.2.3.4' /F -- http://mail.python.org/mailman/listinfo/python-list Fredrik, My apology for any confusion created. I read all the replies. In fact I'm thankful to you all guys who are responding so quickly to all questions. I also add the letter 'v' same as you suggested. However, I'm looking to store this into some variable ( that variable could be be a string, tuple or anything, Im not sure which is the suited one) so that I can access it in some other module that will then display this version information in a Label Widet in GUI. So, what is the best way to store 'v1.2.3.4' in a variable? And, what type of variable is most suited (so as able to be used in other module probably, as string there)? Thanks, Rajat Googled and found : s = v%d.%d.%d.%d % tuple(version) print s it's working. Result is : v1.2.3.4 Thanks, Rajat -- http://mail.python.org/mailman/listinfo/python-list
Windows / Tkinter - problem with grid - not able to place widgets at desired places
Hi, I'm learning Python and Tkinter. I've started programming in Eclipse with PyDev. I'm intending to create a GUI. I'm not able to understand the Grid manager perhaps because there is quite a less documentation available for it on the net. My desired GUI is attached in the mail. Although I've tried writing a class module for this GUI but I'm not able to set all things right in the GUI. The Biggest problem seems to be with the Grid Manager in terms how it divides a window in Rows / columns. etc. I'm not able to place none of the widgets correctly in the GUI. For your convenience, I'm attaching this code also as myModule1.py . Please some one review it and help create me this GUI. PS: The desired GUI is attached as a GIF file. The version v1.4.5.1 is a label the contents of which are dynamically picked. Thanks and regards, Rajat Guys please help me on this topic. No answers make me suspect if I mailed the query as per the mailing list guidelines. Cheers, rajat attachment: Desired GUI.GIF#Filename:myModule1 #Description: Creates the basic Tkinter programs #Author: Rajat Dudeja #Date:16.08.2008 from Tkinter import * #GUI class class myAppGUI: def __init__(self, master): #Start Test Button self.bStartTest = Button( master, \ text = Start Test, \ command = self.hStartTest, \ ) self.bStartTest.config( justify = CENTER, \ padx = 20, \ width = 10, #pady= 5, \ relief = RAISED ) self.bStartTest.grid( row = 10, \ column = 2, \ columnspan = 1, \ sticky = EW) #Commit Results Button self.bCommitResults = Button( master, \ text = Commit Results, \ command = self.hCommitResults \ ) self.bCommitResults.config( justify = CENTER, \ padx = 20, \ #pady= 5, \ width = 10, \ relief = RAISED ) self.bCommitResults.grid( row = 10, \ column = 5, \ columnspan = 1, \ sticky = EW) #Exit Button self.bExit = Button( master, \ text = Exit, \ command = master.quit ) self.bExit.config( justify = CENTER, \ padx = 20, \ width= 10, \ relief = RAISED, \ ) self.bExit.grid( row = 10, \ column = 8, \ columnspan = 1, \ sticky = EW) #Labels and Drop down menus #Label 1 self.lAnalysisLib = Label( master, \ text = Analysis Library:, \ justify = RIGHT) self.lAnalysisLib.grid(row = 0) #Label 2 self.lRefAnalysisLibVer = Label( master, \ text = Reference Analysis Libary Version:, \ justify = LEFT) self.lRefAnalysisLibVer.config( wraplength = 100 ) self.lRefAnalysisLibVer.grid(row = 5) def hStartTest(self): print 'Starting Test...' def hCommitResults(self): print 'Commiting to SVN...' #End of myAppGUI Class # Main Program myRoot = Tk() myRoot.title(Test Automation) myRoot.minsize(800, 400) myAppGUIObject = myAppGUI(myRoot) myRoot.mainloop()-- http://mail.python.org/mailman/listinfo/python-list
Windows / Tkinter - problem with grid - not able to place widgets at desired places
Hi, I'm learning Python and Tkinter. I've started programming in Eclipse with PyDev. I'm intending to create a GUI. I'm not able to understand the Grid manager perhaps because there is quite a less documentation available for it on the net. My desired GUI is attached in the mail. Although I've tried writing a class module for this GUI but I'm not able to set all things right in the GUI. The Biggest problem seems to be with the Grid Manager in terms how it divides a window in Rows / columns. etc. I'm not able to place none of the widgets correctly in the GUI. For your convenience, I'm attaching this code also as myModule1.py . Please some one review it and help create me this GUI. PS: The desired GUI is attached as a GIF file. The version v1.4.5.1 is a label the contents of which are dynamically picked. Thanks and regards, Rajat attachment: Desired GUI.GIF#Filename:myModule1 #Description: Creates the basic Tkinter programs #Author: Rajat Dudeja #Date:16.08.2008 from Tkinter import * #GUI class class myAppGUI: def __init__(self, master): #Start Test Button self.bStartTest = Button( master, \ text = Start Test, \ command = self.hStartTest, \ ) self.bStartTest.config( justify = CENTER, \ padx = 20, \ width = 10, #pady= 5, \ relief = RAISED ) self.bStartTest.grid( row = 10, \ column = 2, \ columnspan = 1, \ sticky = EW) #Commit Results Button self.bCommitResults = Button( master, \ text = Commit Results, \ command = self.hCommitResults \ ) self.bCommitResults.config( justify = CENTER, \ padx = 20, \ #pady= 5, \ width = 10, \ relief = RAISED ) self.bCommitResults.grid( row = 10, \ column = 5, \ columnspan = 1, \ sticky = EW) #Exit Button self.bExit = Button( master, \ text = Exit, \ command = master.quit ) self.bExit.config( justify = CENTER, \ padx = 20, \ width= 10, \ relief = RAISED, \ ) self.bExit.grid( row = 10, \ column = 8, \ columnspan = 1, \ sticky = EW) #Labels and Drop down menus #Label 1 self.lAnalysisLib = Label( master, \ text = Analysis Library:, \ justify = RIGHT) self.lAnalysisLib.grid(row = 0) #Label 2 self.lRefAnalysisLibVer = Label( master, \ text = Reference Analysis Libary Version:, \ justify = LEFT) self.lRefAnalysisLibVer.config( wraplength = 100 ) self.lRefAnalysisLibVer.grid(row = 5) def hStartTest(self): print 'Starting Test...' def hCommitResults(self): print 'Commiting to SVN...' #End of myAppGUI Class # Main Program myRoot = Tk() myRoot.title(Test Automation) myRoot.minsize(800, 400) myAppGUIObject = myAppGUI(myRoot) myRoot.mainloop()-- http://mail.python.org/mailman/listinfo/python-list
How do I organize my Python application code?
Hi, I'm learning Python to write a GUI application using Tkinter Tk. I've evaluated Eclipse and Pydev. With the help of Fabio Zadrozny I successfully installed Eclipse and PyDev. Thanks. Now, I'm learning Eclipse and PyDev. And my problem is that I don't have an understanding of how the code in Python is generally organized, in case my code spans multiple files, modules, etc. I've been using C/C++ althrough my life on Linux and Visaul Studio, so the way their code is organized in a group of header files, source files, etc, I'm looking for a similar way in Python way or an approach to organize my python GUI application code? I'll be using Eclipse and PyDev as my development tools. So, please suggest from these tools prespective. Thanks regards, Rajat Notice: This e-mail is intended solely for use of the individual or entity to which it is addressed and may contain information that is proprietary, privileged, company confidential and/or exempt from disclosure under applicable law. If the reader is not the intended recipient or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If this communication has been transmitted from a U.S. location it may also contain data subject to the International Traffic in Arms Regulations or U.S. Export Administration Regulations and cannot be disseminated, distributed or copied to foreign nationals, residing in the U.S. or abroad, without the prior approval of the U.S. Department of State or appropriate export licensing authority. If you have received this communication in error, please notify the sender by reply e-mail or collect telephone call and de! lete or destroy all copies of this e-mail message, any physical copies made of this e-mail message and/or any file attachment(s). -- http://mail.python.org/mailman/listinfo/python-list
RE: How do I organize my Python application code?
Fredrik Lundh wrote: That's all there is; there's no header files or declaration files or explicitly maintained object files etc; the program itself is just a bunch of Python files. I would simply add that if your python script produces one or more output files (for example a text or graphic file) you might want to have an 'output' directory in your project. Some people use a 'src' directory, but that is not nearly as neccessary as in a complied language. Thanks Ken and Fredrik for your direction. Cheers, Rajat Notice: This e-mail is intended solely for use of the individual or entity to which it is addressed and may contain information that is proprietary, privileged, company confidential and/or exempt from disclosure under applicable law. If the reader is not the intended recipient or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If this communication has been transmitted from a U.S. location it may also contain data subject to the International Traffic in Arms Regulations or U.S. Export Administration Regulations and cannot be disseminated, distributed or copied to foreign nationals, residing in the U.S. or abroad, without the prior approval of the U.S. Department of State or appropriate export licensing authority. If you have received this communication in error, please notify the sender by reply e-mail or collect telephone call and de! lete or destroy all copies of this e-mail message, any physical copies made of this e-mail message and/or any file attachment(s). -- http://mail.python.org/mailman/listinfo/python-list
ActiveState Python v2.5 doesn't come with Tkinter or Tk installed.
Hi, So, now I've finally started using Eclipse and PyDev as an IDE for my GUI Application. I just wrote some sample programs as an hands on. Now I would like to take up Tkinter. I'm using Active State Python version 2.5 and found that there is not Tkinter and Tk module in it. To use Tkinter do I actually require Tk installed on my machine? Please suggest and where can I find both these modules? Also, please direct me to a good and short document on using Tkinter or Tk in Python. Cheers, Rajat Notice: This e-mail is intended solely for use of the individual or entity to which it is addressed and may contain information that is proprietary, privileged, company confidential and/or exempt from disclosure under applicable law. If the reader is not the intended recipient or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If this communication has been transmitted from a U.S. location it may also contain data subject to the International Traffic in Arms Regulations or U.S. Export Administration Regulations and cannot be disseminated, distributed or copied to foreign nationals, residing in the U.S. or abroad, without the prior approval of the U.S. Department of State or appropriate export licensing authority. If you have received this communication in error, please notify the sender by reply e-mail or collect telephone call and de! lete or destroy all copies of this e-mail message, any physical copies made of this e-mail message and/or any file attachment(s). -- http://mail.python.org/mailman/listinfo/python-list
RE: Looking out a module for Subversion
That's not really correct... Pydev should be able to debug (there's a video at http://showmedo.com/videos/video? name=PydevEclipseFabiofromSeriesID=8 http://showmedo.com/videos/video?name=PydevEclipseFabiofromSeriesID=8 which goes from configuring Pydev to debugging source code) and Pydev Extensions can be used for remote debugging ( http://fabioz.com/pydev/manual_adv_remote_debugger.html ) I've installed Ulipad and must say it is a small nice tool. Thanks I also want to give eclipse a try. I referred eclispe web site for this and it does not mention what basic things need installation before you use the Dynamic Language Toolkit. So, my question is : what combination of packages are required for using eclipse as an IDE for python? Thanks, Rajat Notice: This e-mail is intended solely for use of the individual or entity to which it is addressed and may contain information that is proprietary, privileged, company confidential and/or exempt from disclosure under applicable law. If the reader is not the intended recipient or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If this communication has been transmitted from a U.S. location it may also contain data subject to the International Traffic in Arms Regulations or U.S. Export Administration Regulations and cannot be disseminated, distributed or copied to foreign nationals, residing in the U.S. or abroad, without the prior approval of the U.S. Department of State or appropriate export licensing authority. If you have received this communication in error, please notify the sender by reply e-mail or collect telephone call and delete or destroy all copies of this e-mail message, any physical copies made of this e-mail message and/or any file attachment(s). -- http://mail.python.org/mailman/listinfo/python-list
RE: Looking out a module for Subversion
Hi Fabio Download eclipse 3.3 from http://download.eclipse.org/eclipse/downloads/drops/R-3.3.2-200802211800 /index.php (you can download only the Platform Runtime Binary in that link) and then follow the instructions to install Pydev at http://fabioz.com/pydev/manual_101_install.html I see that this link for Pydev provides a commercial version of pydev (so this points the evaluation version of it) . Is there any open source version of it? cheers, Rajat Notice: This e-mail is intended solely for use of the individual or entity to which it is addressed and may contain information that is proprietary, privileged, company confidential and/or exempt from disclosure under applicable law. If the reader is not the intended recipient or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If this communication has been transmitted from a U.S. location it may also contain data subject to the International Traffic in Arms Regulations or U.S. Export Administration Regulations and cannot be disseminated, distributed or copied to foreign nationals, residing in the U.S. or abroad, without the prior approval of the U.S. Department of State or appropriate export licensing authority. If you have received this communication in error, please notify the sender by reply e-mail or collect telephone call and delete or destroy all copies of this e-mail message, any physical copies made of this e-mail message and/or any file attachment(s). -- http://mail.python.org/mailman/listinfo/python-list
Looking out a module for Subversion
Hi, I'm new to Python. I only have read Byte of Python by Swaroop C H just to be familiar with sytax of python. I've installed Python 2.5 from Active State and using its PythonWin Editor / interpreter. This, unfortunaltely, does not help in debugging. I'm looking for an open source IDE / editor that has source level debugging. Please suggest some tool. I'm intending to write a testing tool that uses Subversion. Is there some module available for subversion, out of the box, that I can import in my script? Regards, Rajat Notice: This e-mail is intended solely for use of the individual or entity to which it is addressed and may contain information that is proprietary, privileged, company confidential and/or exempt from disclosure under applicable law. If the reader is not the intended recipient or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If this communication has been transmitted from a U.S. location it may also contain data subject to the International Traffic in Arms Regulations or U.S. Export Administration Regulations and cannot be disseminated, distributed or copied to foreign nationals, residing in the U.S. or abroad, without the prior approval of the U.S. Department of State or appropriate export licensing authority. If you have received this communication in error, please notify the sender by reply e-mail or collect telephone call and de! lete or destroy all copies of this e-mail message, any physical copies made of this e-mail message and/or any file attachment(s). -- http://mail.python.org/mailman/listinfo/python-list