XML-SAX parser problem

2008-03-11 Thread hitesh thakkar
Hello, Can any one help for error in following code. actually i want to map parent element with child element, but i am unable to do so. here is the code which i am trying for please do reply if iam not on right track. import xml.sax.handler class BookHandler(xml.sax.handler.ContentHandler):

Re: List to string

2007-03-19 Thread Hitesh
On Mar 19, 8:11 am, Bruno Desthuilliers bruno. [EMAIL PROTECTED] wrote: Hitesh a écrit : On Mar 18, 12:28 am, Hitesh [EMAIL PROTECTED] wrote: Hi, I've a list like this.. str1 = ['this is a test string inside list'] I am doing it this way. for s in str1: temp_s = s

List to string

2007-03-17 Thread Hitesh
Hi, I've a list like this.. str1 = ['this is a test string inside list'] I am doing it this way. for s in str1: temp_s = s print temp_s Any better suggestions? Thank you, hj -- http://mail.python.org/mailman/listinfo/python-list

Re: List to string

2007-03-17 Thread Hitesh
On Mar 18, 12:28 am, Hitesh [EMAIL PROTECTED] wrote: Hi, I've a list like this.. str1 = ['this is a test string inside list'] I am doing it this way. for s in str1: temp_s = s print temp_s Any better suggestions? Thank you, hj I want to cast value of a list into string

Re: glob.glob output

2007-03-13 Thread Hitesh
On Mar 12, 4:33 pm, Bruno Desthuilliers [EMAIL PROTECTED] wrote: Hitesh a écrit : import string import os f = open (c:\\servername.txt, 'r') linelist = f.read() lineLog = string.split(linelist, '\n') lineLog = lineLog [:-1] #print lineLog for l in lineLog: path1

Re: glob.glob output

2007-03-13 Thread Hitesh
On Mar 13, 11:00 am, Bruno Desthuilliers bruno. [EMAIL PROTECTED] wrote: Hitesh a écrit : On Mar 12, 4:33 pm, Bruno Desthuilliers [EMAIL PROTECTED] wrote: Hitesh a écrit : (snip) Thank you for your reply. From the return value I am trying to figure out whether the file xtRec* exist

glob.glob output

2007-03-12 Thread Hitesh
import string import os f = open (c:\\servername.txt, 'r') linelist = f.read() lineLog = string.split(linelist, '\n') lineLog = lineLog [:-1] #print lineLog for l in lineLog: path1 = + l + \\server*\\*\\xtRec* glob.glob(path1) When I run above from command line python, It prints

Re: glob.glob output

2007-03-12 Thread Hitesh
On Mar 12, 1:58 pm, Hitesh [EMAIL PROTECTED] wrote: import string import os f = open (c:\\servername.txt, 'r') linelist = f.read() lineLog = string.split(linelist, '\n') lineLog = lineLog [:-1] #print lineLog for l in lineLog: path1 = + l + \\server*\\*\\xtRec* glob.glob

Re: glob.glob output

2007-03-12 Thread Hitesh
On Mar 12, 2:12 pm, Hitesh [EMAIL PROTECTED] wrote: On Mar 12, 1:58 pm, Hitesh [EMAIL PROTECTED] wrote: import string import os f = open (c:\\servername.txt, 'r') linelist = f.read() lineLog = string.split(linelist, '\n') lineLog = lineLog [:-1] #print lineLog for l

Re: MS SQL Database connection

2007-03-05 Thread Hitesh
On Mar 5, 4:44 am, Tim Golden [EMAIL PROTECTED] wrote: Hitesh wrote: Hi currently I am using DNS and ODBC to connect to MS SQL database. Is there any other non-dns way to connect? If I want to run my script from different server I first have to create the DNS in win2k3. Here are several

MS SQL Database connection

2007-03-04 Thread Hitesh
Hi currently I am using DNS and ODBC to connect to MS SQL database. Is there any other non-dns way to connect? If I want to run my script from different server I first have to create the DNS in win2k3. Thank you, hj -- http://mail.python.org/mailman/listinfo/python-list

Adding a char inside path string

2006-08-16 Thread Hitesh
Hi, I get path strings from a DB like: \\serverName\C:\FolderName1\FolderName2\example.exe I am writing a script that can give me access to that exe file. But problem is that string is not universal path, I need to add C$. Any idea how I can add $ char in that string. ServerName is not fixed

Re: Adding a char inside path string

2006-08-16 Thread Hitesh
: Hitesh wrote: I get path strings from a DB like: \\serverName\C:\FolderName1\FolderName2\example.exe I am writing a script that can give me access to that exe file. But problem is that string is not universal path, I need to add C$. Any idea how I can add $ char in that string

Re: Adding a char inside path string

2006-08-16 Thread Hitesh
, Dennis Lee Bieber [EMAIL PROTECTED] wrote: On 16 Aug 2006 09:00:57 -0700, Hitesh [EMAIL PROTECTED] declaimed the following in comp.lang.python: Thank you Fredrik. That works for a string. But I am getting list of tuples from DB. rows = [('\\serverName\C:\FolderName1\FolderName2

Documentation Question About Depricated String Functions

2006-08-16 Thread Hitesh
Hi, In python doc -- 4.1.4 Deprecated string functions -- I read that The following list of functions are also defined as methods of string and Unicode objects; see ``String Methods'' (section 2.3.6) for more information on those. You should consider these functions as deprecated, although they

Re: Documentation Question About Depricated String Functions

2006-08-16 Thread Hitesh
Thank you guys. hj Duncan Booth wrote: Hitesh wrote: In python doc -- 4.1.4 Deprecated string functions -- I read that The following list of functions are also defined as methods of string and Unicode objects; see ``String Methods'' (section 2.3.6) for more information on those. You

Re: Adding a char inside path string

2006-08-16 Thread Hitesh
how to get rid any garbase after index + 4 hj Dennis Lee Bieber wrote: On 16 Aug 2006 09:00:57 -0700, Hitesh [EMAIL PROTECTED] declaimed the following in comp.lang.python: Thank you Fredrik. That works for a string. But I am getting list of tuples from DB. rows = [('\\serverName\C

Re: Adding a char inside path string

2006-08-16 Thread Hitesh
\C:\FolderName1\FolderName2\example.exe' -u ABC -g XYZ p=s.split( , 1)[0] print p '\\serverName\C:\FolderName1\FolderName2\example.exe' Larry Bates Hitesh wrote: Hi, Everything is working fine and dandy but I ran across another issue here. Some of the path comes with some extra

Re: Adding a char inside path string

2006-08-16 Thread Hitesh
-g XYZ p=s.split( , 1)[0] print p '\\serverName\C:\FolderName1\FolderName2\example.exe' Larry Bates Hitesh wrote: Hi, Everything is working fine and dandy but I ran across another issue here. Some of the path comes with some extra chars padded at the end. i.e

Re: Adding a char inside path string

2006-08-16 Thread Hitesh
anything after .exe should be truncated (or deleted). Grant Edwards wrote: On 2006-08-16, Hitesh [EMAIL PROTECTED] wrote: That might work but what if I get (in future) a path name where foldername (and in windows it is very common, someone might name a folder something like Screw You

Re: Adding a char inside path string

2006-08-16 Thread Hitesh
Here is a mediocare solution. def TruncateString(s, Tindex): return string.ljust(s,Tindex){:Tindex] s = '\\serverName\\C:\\Folder Name1\\FolderName2\\example.exe -u ABC -g XYZ' Sindex = s.find(.exe) Sindex = Tindex +4 s1 = TruncateString(s, Sindex) Hitesh wrote: anything after .exe

Re: Adding a char inside path string

2006-08-16 Thread Hitesh
. Grant Edwards wrote: On 2006-08-16, Hitesh [EMAIL PROTECTED] wrote: anything after .exe should be truncated (or deleted). That will fail if any directory names contain the string .exe, but if that's what you want, it's trivial enough: for s in [asdfasdf.exe -u, soemthing/else, asdf.exe

Re: Adding a char inside path string

2006-08-16 Thread Hitesh
: pass hj Hitesh wrote: I post a crappy solution but I can add few more stuff to make it fail proof. i.e. I can search for .exe -u But if someone names folder like folder.exe u. This script could fail. Or if in padded garbase I get .exe u These are two known issues I have to takcle

Re: Adding a char inside path string

2006-08-16 Thread Hitesh
There was a typo. I corrected it. Hitesh wrote: How about this: def TruncateString(s, Tindex): return string.ljust(s,Tindex){:Tindex] s = '\\serverName\\C:\\Folder Name1\\FolderName2\\example.exe -u ABC -g XYZ' try: Sindex = s.find(.exe) if Sindex 0: Sindex

Re: Getting previous file name

2006-08-08 Thread Hitesh
.. interesting stuff. Thank you all, hj Hitesh wrote: Hi, I have a small script here that goes to inside dir and sorts the file by create date. I can return the create date but I don't know how to find the name of that file... I need file that is not latest but was created before the last file

Re: Getting previous file name

2006-08-08 Thread Hitesh
John Machin wrote: Hitesh wrote: Hi, I have a small script here that goes to inside dir and sorts the file by create date. I can return the create date but I don't know how to find the name of that file... I need file that is not latest but was created before the last file. Any

Re: Getting previous file name

2006-08-08 Thread Hitesh
] if __name__ == '__main__': path = r'srv12\\c$\\backup\\my_folder' create_date, prev_file = findfile(path) Thank you hj Hitesh wrote: Hi, I have a small script here that goes to inside dir and sorts the file by create date. I can return the create date but I don't know how

ST_CTIME convert to yyyymmdd

2006-08-07 Thread Hitesh
Hi, Any hint on converting time from ST_CTIME secs into mmdd format? sorry for one-liner stupid question.. I couldn;t find (or rather figure out) in docs. Thank you, hj -- http://mail.python.org/mailman/listinfo/python-list

Re: ST_CTIME convert to yyyymmdd

2006-08-07 Thread Hitesh
All right I got it. Thank you anyway... create_date = os.stat(pathname)[ST_CTIME] print time.strftime(%Y%m%d, time.gmtime(create_date)) Hitesh wrote: Hi, Any hint on converting time from ST_CTIME secs into mmdd format? sorry for one-liner stupid question.. I couldn;t find (or rather

Getting previous file name

2006-08-07 Thread Hitesh
Hi, I have a small script here that goes to inside dir and sorts the file by create date. I can return the create date but I don't know how to find the name of that file... I need file that is not latest but was created before the last file. Any hints... I am newbiw python dude and still trying

Is there any better way to approach this problem?

2006-07-19 Thread Hitesh Joshi
Hi, I am newbie python dude. I need few hints. I created a DB table with following fields UserID(PK), TimeStamp, Version, IP, Port I need to insert these info from this .log file and the log file has lines like following with some junk garbase like attempt using client software I need to get

What am I doing wrong here

2006-04-24 Thread Hitesh Joshi
Hi, I wanted to pass a popup mesage using windows messagin service to five PCs. If I just use following then PC1 gets the popup service message: import os os.system('net send PC1 Message') But if I try to create a for loop like this it doesn't work how can I pass computerName var as an

Re: What am I doing wrong here

2006-04-24 Thread Hitesh Joshi
ok here is the deal... I figured out how to pass the variable but now messages are not popping up on the windows screen if I use this method: import os Computerlist = ['PC1', 'PC2', 'PC3', 'PC4', 'PC5'] for ComputerName in Computerlist: print ComputerName s = net send %s % ComputerName

Re: What am I doing wrong here

2006-04-24 Thread Hitesh Joshi
Thank you Robert, It worked!!! Thank you so much -- http://mail.python.org/mailman/listinfo/python-list

Re: What am I doing wrong here

2006-04-24 Thread Hitesh Joshi
Thank you all for the quick replies. It worked! Truely appriciated. I am python novice and still learning I hope to contribute to this group someday :) Hitesh -- http://mail.python.org/mailman/listinfo/python-list