Help Deciphering Code

2007-03-05 Thread Bryan Leber
Good Morning,

I am learning python and I am having to make some changes on an existing
python script. What happens is that one scripts creates an xml document
that looks like this:

 

CommitOperation
file=IPM2.1/Identity/IdentityWebApp/Source/com/fisc/prioss/dataservice/
component/profile ProfileUtil.java message=PATCH_BRANCH: N/A
BUG_NUMBER: N/A FEATURE_AFFECTED: N/A OVERVIEW: Changes for not
including the product configuration account, idmconfig in searches. 
module=IPM2.1

 

The first attribute file as you can see shows the path where the file
is and then a space and the actual file name. This is put into a
variable named file. Then in the script, there is a method called that
passes in this variable. The first line in the method called is this:

 

  reg = re.compile(r'[\\]+[ ]+')

 

I'm not 100% sure what this is doing, but I believe it is trying to
parse the file variable so that you only get the file name. It is weird
because this had been working just fine until about 2 months ago then it
just started not parsing anything. If anyone can help please help:-)

 

Thanks,

 

Bryan Leber

Developer

Fischer International Corporation

www.fischerinternational.com http://www.fischerinternational.com 

[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED] 

Cell:(239)963-5267

 

Secure Your Risk. Increase Your Bottom Line. (tm)

 


**

This mail message may contain confidential and privileged information from 
Fischer International which is
protected. Any unauthorized review, use, disclosure or distribution by any 
means is prohibited. If you are 
not the intended recipient, please contact the sender by reply email and 
destroy all copies of the original 
message.

**

-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Help Deciphering Code

2007-03-05 Thread Terry Reedy

Bryan Leber [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

I am learning python and I am having to make some changes on an existing
python script. What happens is that one scripts creates an xml document
that looks like this:

CommitOperation
file=IPM2.1/Identity/IdentityWebApp/Source/com/fisc/prioss/dataservice/
component/profile ProfileUtil.java message=PATCH_BRANCH: N/A
BUG_NUMBER: N/A FEATURE_AFFECTED: N/A OVERVIEW: Changes for not
including the product configuration account, idmconfig in searches. 
module=IPM2.1

The first attribute file as you can see shows the path where the file
is and then a space and the actual file name. This is put into a
variable named file. Then in the script, there is a method called that
passes in this variable. The first line in the method called is this:
  reg = re.compile(r'[\\]+[ ]+')
I'm not 100% sure what this is doing, but I believe it is trying to
parse the file variable so that you only get the file name. It is weird
because this had been working just fine until about 2 months ago then it
just started not parsing anything. If anyone can help please help:-)

==
I have no idea what changed, but splitting the file var into its two 
components is trivial:

 IPM2.1/Identity/IdentityWebApp/Source/com/fisc/prioss/dataservice/component/profile
  
 ProfileUtil.java.split()

['IPM2.1/Identity/IdentityWebApp/Source/com/fisc/prioss/dataservice/component/profile',
 
'ProfileUtil.java']

If the ' ' were a '/' instead, then the os.path module has a function for 
splitting off the last component, the file name.

Terry Jan Reedy




-- 
http://mail.python.org/mailman/listinfo/python-list