Python web server

2006-06-24 Thread arvind
When I run the script on server,only HTML part gets executed.
But the python code appears as it is on the screen in the text format.
How to run the CGI script on web server using Python2.4.3?

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


Python database access

2006-06-25 Thread arvind
Hi all,
I am going to  work on Python 2.4.3 and MSSQL database server on
Windows platform.
But I don't know how to make the connectivity or rather which module to
import.
I searched for the modules in the Python library, but I couldn't find
which module to go for.
Please help me out!

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


Database access through python using GUI(Tkinter)

2006-06-29 Thread arvind
hi all,
i am accessing  sql+  database through python 2.4.3.
i am using Tkinter to build my screens.
how can i pass parameters on the click event of button from one
function to the another?
how can i run another file from current file?

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


Database access through python using GUI(Tkinter)

2006-06-29 Thread arvind
hi all,
i am accessing  sql+  database through python 2.4.3.
i am using Tkinter to build my screens.
how can i pass parameters on the click event of button from one
function to the another?
how can i run another file from current file?
arvind

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


Widget access

2006-06-29 Thread arvind
how to make the widgets defined inside the function available outside
it without using OOPs concept?

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


Widget access

2006-06-29 Thread arvind
how to make the widgets defined inside the function available outside
it without using OOPs concept?

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


Widget access

2006-06-29 Thread arvind
how to make the widgets defined inside the function available outside
it without using OOPs concept?

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


Tkinter function variable passing

2006-07-02 Thread arvind
How to pass the variables defined inside the function to the another
function on click event of the button in Tkinter?
pleas send me a sample code if anybody has it.
thanx

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


Re: Tkinter function variable passing

2006-07-03 Thread arvind
Hi
thanx for replynig.
but functios are independent
and the button is inside one of the functions.
will u please reshape ur code and send it to me?
thank u.
Fredrik Lundh wrote:
> arvind wrote:
>
> > How to pass the variables defined inside the function to the another
> > function on click event of the button in Tkinter?
>
>  def the_function(master):
>
>  variable = ...
>
>  def callback():
>  print variable
> 
>  b = Button(master, command=callback)
> 
> 

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


Re: Tkinter function variable passing

2006-07-03 Thread arvind
please send it to-[EMAIL PROTECTED]


Fredrik Lundh wrote:

> "arvind" <[EMAIL PROTECTED]> wrote:
>
> > thanx for replynig.
> > but functios are independent
> > and the button is inside one of the functions.
> > will u please reshape ur code and send it to me?
> 
> where do I send the invoice ?
> 
> 

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


How can I access the 'Entry' string in another function?

2006-07-03 Thread arvind
hi all,
i've created the myclass instance and calles the "function second()".
i want to access the text entered in 'w' through Entry widget in
"function third()"
i am getting the 'fuction not having 'w' attribute error.
how to overcome it?


class myclass:
senter='arvind'

def __init__(self):
return None

def third(self):
self.senter=self.w.get()
print senter

def second(self):
top=Tk()
frame=Frame(top)
frame.master.title("second")

strobj=StringVar()
w=Entry(top)

b1=Button(top,text='Next',command=self.third)

w.grid()
b1.grid()
frame.grid()

mainloop()

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


How to increase the window sinze in python?

2006-07-07 Thread arvind
hi all,
i want to inctrease the window size in python and make it as big as
normal window.
at the same time i want to change the background colour of the screen.
what's the solution?

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


How to use images at the bachground?

2006-07-11 Thread arvind
hi all,
how to get out of the python shell which is executing a command?
how to use images in the background of a page in Tkinter?

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


Re: Memory leak/gc.get_objects()/Improved gc in version 2.5

2007-10-09 Thread arvind
On Oct 9, 7:54 am, "Chris Mellon" <[EMAIL PROTECTED]> wrote:
> On 10/8/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
>
>
> > I'm running a python program that simulates a wireless network
> > protocol for a certain number of "frames" (measure of time).  I've
> > observed the following:
>
> > 1. The memory consumption of the program grows as the number of frames
> > I simulate increases.
>
> > To verify this, I've used two methods, which I invoke after every
> > frame simulated:
>
> > --  Parsing the /proc//status file as in:
> >http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/286222
> > --  Using ps vg | grep python | awk '!/grep/ {print " ",$8}'  in an
> > os.system() call.
>
> > The memory usage vs. frame number graph shows some big "jumps" at
> > certain points, and, after a large number of frames, shows a steady
> > upward slope
>
> This would be expected if you're creating ever-larger amounts of
> objects - python uses memory pools and as the number of simultaneous
> objects increases, the size of the pool will need to increase. This
> isn't expected if the total number of objects you create is pretty
> much static, but the way you're trying to determine that is flawed
> (see below).
>
>
>
> > 2. I think I've verified that the objects I instantiate are actually
> > freed-- I'm therefore assuming that this "leak" is "caused" by
> > python's garbage collection mechanism. I count the number of objects I
> > generate that are being tracked by gc as follows:
>
> > gc.collect()
> > objCount = {}
> > objList = gc.get_objects()
> > for obj in objList:
> > if getattr(obj, "__class__", None):
> > name = obj.__class__.__name__
> > if objCount.has_key(name):
> > objCount[name] += 1
> > else:
> > objCount[name] = 1
>
> > for name in objCount:
> > print name, " :", objCount[name]
>
> >del objList
>
> > Running this snippet every hundred frames or so, shows that the number
> > of objects managed by gc is not growing.
>
> > I upgraded to Python 2.5. in an attempt to solve this problem. The
> > only change in my observations from version 2.4 is that the absolute
> > memory usage level seems to have dropped. However, I still see the
> > jumps in memory usage at the same points in time.
>
> > Can anybody explain why the memory usage shows significant jumps (~200
> > kB or ~500 kb) over time (i.e. "frames") even though there is no
> > apparent increase in the objects managed by gc? Note that I'm calling
> > gc.collect() regularly.
>
> You're misunderstanding the purpose of Pythons GC. Python is
> refcounted. The GC exists only to find and break reference cycles. If
> you don't have ref cycles, the GC doesn't do anything and you could
> just turn it off.
>
> gc.get_objects() is a snapshot of the currently existing objects, and
> won't give you any information about peak object count, which is the
> most direct correlation to total memory use.
>
> > Thanks for your attention,
>
> > Arvind
>
> > --
> >http://mail.python.org/mailman/listinfo/python-list

Chris,

Thanks for your reply.

To answer the earlier question, I used CPython 2.4.3 and ActivePython
2.5.1 in my analysis above. No custom modules added. Interpreter
banners are at the end of this message.

In my program, I do keep instantiating new objects every "frame".
However, these objects are no longer needed after a few frames, and
the program no longer maintains a reference to old objects. Therefore,
I expect the reference-counting mechanism built into python (whatever
it is, if not gc) to free memory used by these objects and return it
to the "pool" from which they were allocated. Further, I would expect
that in time, entire pools would become free, and these free pools
should be reused for new objects. Therefore the total number of pools
allocated (and therefore "arenas"?) should not grow over time, if
pools are being correctly reclaimed. Is this not expected behavior?

Also, since I sample gc.get_objects() frequently, I would expect that
I would stumble upon a "peak" memory usage snapshot, or at the very
least see a good bit of variation in the output. However, this does
not occur.

Finally, if I deliberately hold on to references to old objects,
gc.get_objects() clearly shows an increasing number of objects being
tracked in each snapshot, and the memory leak is well explained.

Python version info:

ActivePython 2.5.1.1 (ActiveState Software Inc.) based on
Python 2.5.1 (r251:54863, May  2 2007, 08:46:07)
[GCC 3.3.4 (pre 3.3.5 20040809)] on linux2

AND

Python 2.4.3 (#1, Mar 14 2007, 19:01:42)
[GCC 4.1.1 20070105 (Red Hat 4.1.1-52)] on linux2


Arvind

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


Modify Settings window pop-up

2016-01-17 Thread Arvind Vallabhaneni

I installed the python interpreter and pycharm program onto my home desktop. 
However, while doing some simple programming exercises from class, the window 
below keeps popping up every time I type a few words or try to run the program.


[cid:888c5934-3c75-43d8-9e76-59a9dfbef814]


 I tried to click repair, and it didn't make a difference; I also tried to 
minimize it and continue working, but it still keeps popping up.

Is there a setting or something I installed incorrectly for it to do this? I am 
not able to work for more than 10 or 15 seconds at a time because this window 
comes up so frequently. Please let me know if there is a way to resolve this, I 
was not able to find a solution through Google or your website. Thank you in 
advance for your help.


Best regards,

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


Re: questions about programming styles

2007-05-20 Thread Arvind Singh
On 5/20/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> which is the better way to calculate the value of attributes of a class ?
> for example:
>
>  (A)
> def cal_attr(self, args):
> #do some calculations
> self.attr = calculated_value
> and then if the vlue of attribute is needed,
> self.cal_attr(args)
> some_var = self.attr
> or I can define cal_attr() as follows:
>  (B)
> def cal_attr(self, args):
> #do some calculations
> return calculated_value
> and then, if the value of attribute is needed,
> self.attr = self.cal_attr(args)
> some_var = self.attr

The way, I get it: you are trying to *cache* the value of an
*expensive* calculation. You should worry about it if only if:
a. It is *really* expensive to calculate the value.
b. The value is read more often then it can change.

Otherwise, just don't bother with it (i.e.use some_var = obj.cal_value(*args) ).

But if you really want to cache the value, maybe you should keep track
if the value is valid:

class C(object):
def calc_attr(self, *args):
"""Calculates value of "attr".
"""
self._attr = calculated_value
self._attr_valid = True

def get_attr(self, *args):
"""Use this to get values."""
self._attr_valid or self.calc_attr(*args)
return self._attr

def another_method(self, *args):
"""Does some calculations which invalidate *cached* value of "attr".
"""
# do something
self._attr_valid = False

> (2)
> when to use class methods and when to use functions ?
>
> In my opinion, both of class methods and functions have advantages and
> disadvantages. I have to pass many arguments to a function, which is
> annoying. When using class methods, the arguments can be stored as
> attributes of the class, which is convenient for later use. But I have
> to create an object in advance.


I hope you know about all of it, but here it is, anyway:

- In Python, *everything* is an object.
- Whenever Python finds a class definition, it creates a *class object*.
- A class objects acts as a *template* to create new objects called
*instances* (of that class).
- The template and the instance can both have *attributes* (to store data).
- *Class attributes* can be accessed by both -- class as well as its instances.
- *Instance attributes* can only be accesses by instances (because
class doesn't have to know about these).
- All the class attributes are shared among all the instances. If you
change an attribute of a class, all the instances of that class
(irrespective of when they were instantiated) will see the change.

That gives us:
- *Instance methods* (or simply, "methods") can access: class
attributes, instance attributes, class methods, and instance methods.
(And are accessible via an instance only.)
- *Class methods* can ONLY access class attributes or other class
methods. (And are accessible via the class or its instance.)
- The first argument to instance methods is traditionally called
"self" (which is an *instance object*) and that of class methods is
called "cls" (which is a *class object*).


Design choices:
- The data which is to be shared by all the instances (and is mostly
immutable) should be kept as class attribute (to minimize memory
consumption).
- The methods which should produce same result for all instances (and
don't need to access instance attributes) should be declared as class
methods.
- Class attributes are also useful to *share state* among various
instances (so that they can co-operate). Such "sharing functionality"
is mostly implemented as class methods.


It's just whatever I could recollect and thought might be relevant. I
hope it helps.

Arvind


PS: Defining something as "property" suggests (to the class users)
that it is inexpensive to access that value -- just a matter of style.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Killing A Process By PID

2007-09-20 Thread Arvind Singh
 file('/var/lock/Application.lock', 'w').write(str(os.getpid()))
>
>  Which to be honest appears to run just fine, when I look in that file it
> always contains the correct process ID, for instance, 3419 or something like
> that.
>
I honestly doubt that. The I/O is buffered and you need to flush()/close()
the file. Otherwise data may not get written until python interpreter exits.

  if file('/proc/%s/cmdline' % pid).read().endswith('python'):
>
> os.system('kill %s' % pid)
>
Are you sure about endswith('python')?
Maybe you need find('python') != -1.

-- 
Regards,
Arvind
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Killing A Process By PID

2007-09-22 Thread Arvind Singh
> file('/var/lock/Application.lock', 'w').write(str(os.getpid()))
> >
> >  Which to be honest appears to run just fine, when I look in that file
> > it always contains the correct process ID, for instance, 3419 or something
> > like that.
> >
> I honestly doubt that. The I/O is buffered and you need to flush()/close()
> the file. Otherwise data may not get written until python interpreter exits.
>
>
> Isn't the file closed after the file().write()?  Seems to me that the
> great garbage collector in the sky will happily flush(), close() and forget
> it ever happened...
>

Yes, the GC will flush()/close() the file properly. My mistake, sorry about
that.

-- 
Regards,
Arvind
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: HOT!!!PYTHON DEVELOPER REQUIRED @ ADOBE SYSTEMS

2007-09-29 Thread Arvind Singh
THANKS for introducing me to Python "applets".

Applications --> Applets --> Apploids --> Applcainers --> ... -->
Approcities


Sorry, couldn't resist.


On 9/27/07, Recruiter-Adobe <[EMAIL PROTECTED]> wrote:
>
> Hi PYTHON DEVELOPERS,
>
> ADOBE SYSTEMS is looking for a PYTHON DEVELOPER who can troubleshoot
> Python based applet which makes data base queries and populates Excel
> tables used to generate pivot charts, graphs and tables showing bug
> metrics. Isolate problem which is causing reports to crash and
> institute fix.
>
> This is a position through Manpower at our customer Adobe Systems,
> you will be employed as a Manpower's contractor.
>
> Job Responsibilities:
>
> · Setup a new server (development environment)
>
> · Install updated versions of both python and other plugins
> used for our applet.
>
> · Import Code/applet  instance.
>
> · Remove code that uploads it to the Production Server
> Instance
>
> · Eventually move the entire Production Instance over to the
> newer server.
>
> · Update Code to comply with the latest Python standards
>
> Knowledge & Skills:
>
> · Expert in Python Programming
>
> · Experience in COM Object programming speficially Excel COM
> Objects
>
> · Experience in using WebServices (SOAP)
>
> · Win2k System Administration Experience a Plus
>
> · Need to migrate from version 2.3 to latest version of Python
>
> Hourly Pay rate: $85-$100/hr
>
> If interested, please send a Word copy of your resumeto
> [EMAIL PROTECTED] with your expected hourly rate, availability,
> visa status, best time and phone # to contact you.
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 
Regards,
Arvind
-- 
http://mail.python.org/mailman/listinfo/python-list