Writing different sections into a file

2016-04-25 Thread Palpandi
Hi,

I need to write different sections into a file.
At any point of time, content can be added to any section.

I don't want keep each section into a temporary file.
What is the better way to store the contents of each section and write them 
into a file at the end?
What is the better datatype to achieve this?


Thanks and Regards,
Palpandi
-- 
https://mail.python.org/mailman/listinfo/python-list


Unit test a class with xml elements

2016-05-24 Thread Palpandi
Hi,

How can I unit test a class which using xml elements?
There is a posiibility of different combinations of xml.

What is the better way to test this kind of class?
XML binding is used here.

Share if any examples available.


Thanks.
-- 
https://mail.python.org/mailman/listinfo/python-list


SystemError in python 2.5.4

2015-12-10 Thread Palpandi
Hi All,

I am getting the error mentioned below in python 2.5.4.

SystemError: \loewis\25\python\Objects\longobject.c:225: bad argument to 
internal function.

I also ran the same code in python 2.7.
There I am not getting this error.

I don't know which causes this error. Any solution for this?

Note: The error is coming from the method call findall(path).


Thanks.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: SystemError in python 2.5.4

2015-12-10 Thread Palpandi
On Thursday, December 10, 2015 at 5:08:05 PM UTC+5:30, Chris Angelico wrote:
> On Thu, Dec 10, 2015 at 10:29 PM, Palpandi  wrote:
> > Hi All,
> >
> > I am getting the error mentioned below in python 2.5.4.
> >
> > SystemError: \loewis\25\python\Objects\longobject.c:225: bad argument to 
> > internal function.
> >
> > I also ran the same code in python 2.7.
> > There I am not getting this error.
> >
> > I don't know which causes this error. Any solution for this?
> >
> > Note: The error is coming from the method call findall(path).
> >
> 
> Interesting! What platform (OS, etc) are you running this on? Python
> 2.5 isn't supported any more, so you might have to talk to Red Hat or
> someone. Alternatively, given that 2.7 doesn't have this problem, can
> you simply write it off as an issue with the older Python, and use 2.7
> instead?
> 
> ChrisA

ChrisA, Thanks for your quick response. 
I am using Windows and we are using 2.5.4 only.
Is there any workaround?
-- 
https://mail.python.org/mailman/listinfo/python-list


pyd file for python package using cython

2016-01-09 Thread Palpandi
Hi All,

I have a package structure,

A ( uses files from B and C)
B ( init.py, a,py, b.py)
C ( init.py, c.py, d.py)

How to create a pyd file structure for above package structure?
Is it possible to create a single pyd file?
Do I need cython to run pyd file?

Thanks.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: empty clause of for loops

2016-03-19 Thread Palpandi
On Wednesday, March 16, 2016 at 3:53:48 PM UTC+5:30, Sven R. Kunze wrote:
> Hi,
> 
> a colleague of mine (I write this mail because I am on the list) has the 
> following issue:
> 
> 
> for x in my_iterable:
>  # do
> empty:
>  # do something else
> 
> 
> What's the most Pythonic way of doing this?
> 
> Best,
> Sven

You can do like this.

if not my_iterable:

for x in my_iterable:

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


Re: why x is changed in the following program?

2016-03-19 Thread Palpandi
On Friday, March 18, 2016 at 3:53:58 PM UTC+5:30, 
maurice...@telecom-paristech.fr wrote:
> from numpy import random
> x=random.randn(6)
> y=x
> y[0]=12
> print x[0]
> 
> 
> 
> Maurice Charbit
> Emeritus Prof.
> mob.: 33 (0)6 5230 1171
> tel.: 33 (0)1 4581 7178
> fax:  33 (0)1 4581 7144
> maurice.char...@telecom-paristech.fr 
> 
> Adresse:
> Institut Mines-Telecom,
> 46, rue Barrault, 75014 Paris

http://stackoverflow.com/questions/6793872/variable-assignment-and-modification-in-python

if 
a = 5
b = a
print id(a) == id(b)
>> False
b = 2
print a
>> 5

In this case we assigning the value to b.

But in the above case, we are assigning the same object reference. Like arrays 
in c.
-- 
https://mail.python.org/mailman/listinfo/python-list


Exception from pyd methods

2016-03-20 Thread Palpandi
Hi,

I am using methods from pyd files. At some cases, it is throwing some error 
messages in the console.

When I use try.. except.. I am getting only the exception name.
Not able to catch the entire error message.

How do I get the the entire error message printed in the console?


Thanks,
Palpandi
-- 
https://mail.python.org/mailman/listinfo/python-list


Exception Handling

2015-04-09 Thread Palpandi
Hi all,

Is there any way to roll back or undo changes which are all done before 
exception occurs.
-- 
https://mail.python.org/mailman/listinfo/python-list


Dependency Injection

2015-04-10 Thread Palpandi
Hi all,

Can anyone explain about the dependency injection concept in python?

I have a class A. A is used in all other classes(B, C, D, ..). Is it good to 
use dependency injection concept in this situation or else any other 
suggestions? 

Thanks in advance.
-- 
https://mail.python.org/mailman/listinfo/python-list


Encrypt python files

2015-05-05 Thread Palpandi
Hi,

What are the ways to encrypt python files?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Encrypt python files

2015-05-06 Thread Palpandi
On Wednesday, May 6, 2015 at 12:07:13 PM UTC+5:30, Palpandi wrote:
> Hi,
> 
> What are the ways to encrypt python files?

No, I just want to hide the scripts from others.
-- 
https://mail.python.org/mailman/listinfo/python-list


Regular Expression

2015-06-04 Thread Palpandi
Hi All,

This is the case. To split "string2" from "string1_string2" I am using 
re.split('_', "string1_string2", 1)[1].

It is working fine for string "string1_string2" and output as "string2". But 
actually the problem is that if a sting is "__string1_string2" and the output 
is "_string1_string2". It is wrong.

How to fix this issue?
-- 
https://mail.python.org/mailman/listinfo/python-list


XML Binding

2015-09-03 Thread Palpandi
Hi All,

Is there any module available in python standard library for XML binding? If 
not, any other suggestions.

Which is good for parsing large file?
1. XML binding
2. Creating our own classes


Thanks,
Palpandi
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: XML Binding

2015-09-03 Thread Palpandi
Thanks Burak.

lmxl is good. But it is not supported with python 2.5. Any other option?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: XML Binding

2015-09-07 Thread Palpandi
Hi All,

Is it better to use pyxb than lxml?

What are the advantages of lxml and pyxb?

Thanks,
Palpandi
-- 
https://mail.python.org/mailman/listinfo/python-list