AttributeError: 'module' object has no attribute 'fork'

2014-08-06 Thread Satish ML
Hi, Code: import os, time def child(pipeout): zzz = 0 while True: time.sleep(zzz) msg = ('Spam %03d' % zzz).encode() os.write(pipeout, msg) zzz = (zzz+1) % 5 def parent(): pipein, pipeout = os.pipe() if os.fork() == 0: child(pipeout) else

TypeError: 'bytes' object is not callable error while trying to converting to bytes.

2014-08-04 Thread Satish ML
Hi, >>>import struct >>>file = open('data.bin', 'rb') >>>bytes = file.read() >>> records = [bytes([char] * 8) for char in b'spam'] Traceback (most recent call last): File "", line 1, in records = [bytes([char] * 8) for char in b'spam'] File "", line 1, in records = [bytes([char] * 8

TypeError: 'NoneType' object is not callable

2014-07-28 Thread Satish ML
Hi, TypeError: 'NoneType' object is not callable? Why this error and what is the solution? Code: class SuperMeta: def __call__(self, classname, supers, classdict): print('In SuperMeta.call: ', classname, supers, classdict, sep='\n...') Class = self.__New__(classname, supers, c

Re: Return class.

2014-07-26 Thread Satish ML
Hi, Which lines of code prints [4] and [4, 5, 6, 7] in the output? Output: CARST Trace: display 1 Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam! [1] Trace: name 1 Bob Trace: pay 2 2000 Trace: name 1 Sue Trace: pay 2 6000 Trace: name 3 Bob Trace: pay 4 2000 [4, 2] INSIDE MyList [1, 2, 3] Trace: appen

Re: Return class.

2014-07-26 Thread Satish ML
Actual program: def Tracer(aClass): class Wrapper: def __init__(self, *args, **kargs): self.fetches = 0 self.wrapped = aClass(*args, **kargs) def __getattr__(self, attrname): print('Trace: ' + attrname) self.fetches += 1

Re: Return class.

2014-07-26 Thread Satish ML
Which line of code is printing [4] and [4, 5, 6, 7] in the output? from tracer import Tracer @Tracer class MyList(list): def __init__(self, *args): print("INSIDE MyList") print(*args) x = MyList([1, 2, 3]) x.append(4) print(x.wrapped) WrapList = Tracer(list) x = WrapLis

Re: Return class.

2014-07-26 Thread Satish ML
Which line of code is printing [4] and [4, 5, 6, 7] in the output? from tracer import Tracer @Tracer class MyList(list): def __init__(self, *args): print("INSIDE MyList") print(*args) x = MyList([1, 2, 3]) x.append(4) print(x.wrapped) WrapList = Tracer(list) x = WrapList([4, 5,

Re: Return class.

2014-07-26 Thread Satish ML
Which line of code is printing [4] and [4, 5, 6, 7] in the output? from tracer import Tracer @Tracer class MyList(list): def __init__(self, *args): print("INSIDE MyList") print(*args) x = MyList([1, 2, 3]) x.append(4) print(x.wrapped) WrapList = Tracer(list) x = WrapLis

Return class.

2014-07-26 Thread Satish ML
Hi, What does "return Wrapper" do in the following piece of code? Which method does it invoke? I mean "return Wrapper" invokes __init__ method? def Tracer(aClass): class Wrapper: def __init__(self, *args, **kargs): self.fetches = 0 self.wrapped = aClass(*args,

Re: Copying non-existing files, was Re: Copying files from sub folders under source directories into sub folders with same names as source directory sub folders in destination directories without over

2014-05-21 Thread Satish ML
On Wednesday, May 21, 2014 2:42:49 PM UTC+5:30, Peter Otten wrote: > Satish ML wrote: [Regarding subject: let's see if we can trigger a buffer > overflow somewhere ;)] > On Wednesday, May 21, 2014 6:59:40 AM UTC+5:30, > Rustom Mody wrote: >> On Tuesday, May 20, 2

Re: Copying files from sub folders under source directories into sub folders with same names as source directory sub folders in destination directories without overwriting already existing files of sa

2014-05-21 Thread Satish ML
On Wednesday, May 21, 2014 6:59:40 AM UTC+5:30, Rustom Mody wrote: > On Tuesday, May 20, 2014 9:35:10 PM UTC+5:30, Jagadeesh N. Malakannavar > wrote: > Hi Satish, > > Can you please send python part in plain text format? > Python code here is > > difficult to read. It would be helpful to read >

Re: Copying files from sub folders under source directories into sub folders with same names as source directory sub folders in destination directories without overwriting already existing files of sa

2014-05-20 Thread Satish ML
On Tuesday, May 20, 2014 5:54:47 PM UTC+5:30, Satish ML wrote: > On Tuesday, May 20, 2014 5:51:19 PM UTC+5:30, Satish ML wrote: > On Tuesday, > May 20, 2014 11:27:01 AM UTC+5:30, Rustom Mody wrote: > On Monday, May 19, > 2014 2:32:36 PM UTC+5:30, Satish ML wrote: > On Monday,

Re: Copying files from sub folders under source directories into sub folders with same names as source directory sub folders in destination directories without overwriting already existing files of sa

2014-05-20 Thread Satish ML
On Tuesday, May 20, 2014 5:51:19 PM UTC+5:30, Satish ML wrote: > On Tuesday, May 20, 2014 11:27:01 AM UTC+5:30, Rustom Mody wrote: > On > Monday, May 19, 2014 2:32:36 PM UTC+5:30, Satish ML wrote: > On Monday, May > 19, 2014 12:31:05 PM UTC+5:30, Chris Angelico wrote: > >

Re: Copying files from sub folders under source directories into sub folders with same names as source directory sub folders in destination directories without overwriting already existing files of sa

2014-05-20 Thread Satish ML
On Tuesday, May 20, 2014 11:27:01 AM UTC+5:30, Rustom Mody wrote: > On Monday, May 19, 2014 2:32:36 PM UTC+5:30, Satish ML wrote: > On Monday, > May 19, 2014 12:31:05 PM UTC+5:30, Chris Angelico wrote: > > On Mon, May 19, > 2014 at 4:53 PM, wrote: > Could you kindly hel

Re: Copying files from sub folders under source directories into sub folders with same names as source directory sub folders in destination directories without overwriting already existing files of sa

2014-05-20 Thread Satish ML
On Tuesday, May 20, 2014 5:51:19 PM UTC+5:30, Satish ML wrote: > On Tuesday, May 20, 2014 11:27:01 AM UTC+5:30, Rustom Mody wrote: > On > Monday, May 19, 2014 2:32:36 PM UTC+5:30, Satish ML wrote: > On Monday, May > 19, 2014 12:31:05 PM UTC+5:30, Chris Angelico wrote: > >

Re: Copying files from sub folders under source directories into sub folders with same names as source directory sub folders in destination directories without overwriting already existing files of sa

2014-05-19 Thread Satish ML
On Monday, May 19, 2014 12:31:05 PM UTC+5:30, Chris Angelico wrote: > On Mon, May 19, 2014 at 4:53 PM, wrote: > Could > you kindly help? Sure. Either start writing code and then post when you have > problems, or investigate some shell commands (xcopy in Windows, cp in Linux, > maybe scp) that c

Re: Copying files from sub folders under source directories into sub folders with same names as source directory sub folders in destination directories without overwriting already existing files of sa

2014-05-19 Thread Satish ML
On Monday, May 19, 2014 12:31:05 PM UTC+5:30, Chris Angelico wrote: > On Mon, May 19, 2014 at 4:53 PM, wrote: > Could > you kindly help? Sure. Either start writing code and then post when you have > problems, or investigate some shell commands (xcopy in Windows, cp in Linux, > maybe scp) that c