[BangPypers] [SQLAlchemy R&D] Working of Session in thread

2013-10-10 Thread Saju M
Could someone please explain, Howto sqlalchemy creating new Session and connection inside the thread. Please check the attached programme and output. I went through the doc http://docs.sqlalchemy.org/en/latest/orm/session.html#thread-local-scope and find that sqlalchemy using "threading.local()"

Re: [BangPypers] Debugging functions/tools/ways

2013-09-13 Thread Saju M
I use traceback with exception(dummy exception) to find the flow of the programme (files, methods, statements, etc--) import traceback traceback.print_exc() Regards Saju Madhavan +91 09535134654 On Fri, Sep 13, 2013 at 3:18 PM, Bibhas wrote: > Yeah. Pudb is good. But I could not leave the simp

[BangPypers] Debugging functions/tools/ways

2013-09-13 Thread Saju M
Hi, What are the functions/tools/ways you guys are using for debugging. Like,, To get list of attributes of a module, class, instance, --- --- dir(object) To get __dict__ attribute of a module, class, instance, --- --- vars(object) Debugger import pdb; pdb.set_tr

Re: [BangPypers] Favorite tips/techniques

2013-09-13 Thread Saju M
>>> dir(json) ['JSONDecoder', 'JSONEncoder', '__all__', '__author__', '__builtins__', '__doc__', '__file__', '__name__', '__package__', '__path__', '__version__', '_default_decode

Re: [BangPypers] Favorite tips/techniques

2013-09-13 Thread Saju M
Import sub-modules with alias. Is it a bug ? >>> >>> import json >>> from json import tool >>> >>> >>> import json as sjson >>> from sjson import tool Traceback (most recent call last): File "", line 1, in ImportError: No module named sjson >>> ___

Re: [BangPypers] Favorite tips/techniques

2013-09-10 Thread Saju M
7;, 'load', 'loads', 'scanner'] >>> * How to list all modules of a package in python console ?. * Is this what you guys are using to check modules of a package ?. ls /usr/lib/python2.7/json/ | grep .py$ decoder.py encoder.py __init__.py scanner.py

Re: [BangPypers] Favorite tips/techniques

2013-09-10 Thread Saju M
echo '{"name": "Bangpypers", "location": "Bangalore"}' | python -m json.tool In this command, what is this "json.tool" ? I could not find "tool" in dir(json) >>> import json >>> dir(json) ['JSONDecoder', 'JSONEncoder', '__all__', '__author__', '__builtins__', '__doc__', '__file__', '__name__', '

Re: [BangPypers] python: HTTP connections through a proxy server requiring authentication

2013-01-28 Thread Saju M
p://user:pass@10.10.1.10:3128";, > "https": "http://user:pass@10.10.1.10:1080",} > requests.get("http://example.org";, proxies=proxies) > > > Regards, > Abdul Muneer > @abdulmuneer > > Regards, > Abdul Muneer > > -- > Follow

[BangPypers] python: HTTP connections through a proxy server requiring authentication

2013-01-27 Thread Saju M
Hi, I followed http://dabase.com/blog/Minimal_squid3_proxy_configuration/ to setup proxy server. I tested proxy server with firefox with IP:127.0.0.1/192.168.1.6 and Port:3128 and it working (asking for proxy username and password). But, i could not make http connection through proxy server requi

[BangPypers] I am facing an issue while decoding json string using json.loads

2012-12-25 Thread Saju M
Hi, I am facing an issue while decoding json string using json.loads(jstring). Its working, if i do json.dumps(eval(jstring)) before json.loads(jstring). I could not figure out the issue. I want to avoide use of "eval" here. * Failing without json.dumps(eval(jstring)) ##

[BangPypers] sqlalchemy nested scoped session

2012-11-17 Thread Saju M
Hi, The code bellow throwing error "ObjectDeletedError: Instance 'xxx' has been deleted." when a exception throwing from "method1". * Error in line method1(db_obj1.id), db_obj1.id failing. * The rollback in method1 rollbacking transaction in main_method. * I want to isolate transaction in main_me

Re: [BangPypers] Help required to design classes

2012-10-09 Thread Saju M
Hi Anand, Thanks, let me try. Regards Saju Madhavan +91 09535134654 On Tue, Oct 9, 2012 at 3:00 PM, Anand Chitipothu wrote: > > So, can i do like this ??? > > > > class BMixin: > > > > class B(BMixin, A): > > > > class Q(BMixin, P): > > Yes. But adding the mixin class at the end might be bett

Re: [BangPypers] Help required to design classes

2012-10-09 Thread Saju M
in class "A". class "Q" should contain methods defined in class "P" also. So, can i do like this ??? class BMixin: class B(BMixin, A): class Q(BMixin, P): Thanks, On Tue, Oct 9, 2012 at 2:34 PM, Anand Chitipothu wrote: > On Tue, Oct 9, 2012 at 2:31 PM, S

[BangPypers] Help required to design classes

2012-10-09 Thread Saju M
Hi, I have two classes "A" and "B" class A: def __init__(self, input): //do something on input class B(A): def __init__(self, input): A.__init__(self, input) //do something Then, I want to create two new classes "P" and "Q" class P: def __init__(self,

[BangPypers] Unpacking Tuple

2012-10-06 Thread Saju M
Hi, I am using python 2.6. I need a way to make following code working without any ValueError . >>> a, b, c, d = (1,2,3,4) >>> a, b, c, d = (1,2,3). Note: Number of values in the tuple will change dynamically. I know in python 3, you can do `a, b, c, *d = (1, 2, 3)` and then d will contain any

[BangPypers] psphere: how to make thread safe

2012-08-22 Thread Saju M
Hi, psphere: Python interface for the VMware vSphere Web Services SDK I already developed an app using https://bitbucket.org/jkinred/psphere. But getting lot of errors since psphere is not thread safe (I think). So i wrote couple of scripts to test it (See attached files) and found that caching m

Re: [BangPypers] June Meetup

2012-06-05 Thread Saju M
Hi, Yes, i have, using boto API. On Tue, Jun 5, 2012 at 4:19 PM, Anand Balachandran Pillai < abpil...@gmail.com> wrote: > On Mon, Jun 4, 2012 at 2:23 PM, Deepak Garg >wrote: > > > Hi All, > > > > I have scheduled the June meetup on June 16, the third Saturday in this > > month. The meetup time

Re: [BangPypers] log and figure out what bits are slow and optimize them.

2012-02-12 Thread Saju M
Hi, I am using Turbogears On Mon, Feb 13, 2012 at 11:30 AM, Devi wrote: > On Fri, Feb 10, 2012 at 5:59 PM, Saju M wrote: > > Hi, > > > > I want to log time taken to complete database requests inside a > > method/function using decorator . is it possible > &

Re: [BangPypers] log and figure out what bits are slow and optimize them.

2012-02-11 Thread Saju M
rn timed ref : http://stackoverflow.com/questions/5375624/a-decorator-that-profiles-a-method-call-and-logs-the-profiling-result On Fri, Feb 10, 2012 at 7:24 PM, Noufal Ibrahim wrote: > Saju M writes: > > > Hi, > > > > Yes i saw profile module, I think, i have to do function

Re: [BangPypers] log and figure out what bits are slow and optimize them.

2012-02-10 Thread Saju M
will cause any performance issue ?? On Fri, Feb 10, 2012 at 6:20 PM, Noufal Ibrahim wrote: > Saju M writes: > > > Hi, > > > > I want to log time taken to complete database requests inside a > > method/function using decorator . is it possible > &

[BangPypers] log and figure out what bits are slow and optimize them.

2012-02-10 Thread Saju M
Hi, I want to log time taken to complete database requests inside a method/function using decorator . is it possible I think, i have to inject log code inside the method/fuctions or modify it. I wrote a decorator to log taken by a method/function to complete it execution and its working well

[BangPypers] turbogears to pyramid or django

2012-02-01 Thread Saju M
HI, I have a project developed in turbogears, i want to move it to Pyramid or Django, which is the best option ??? I am using following feature of TG2 controller sqlalchemy tg2env developement.ini Not using any template system, since UI developed using EXTJS Reason to this change is, Pylons stop

[BangPypers] unfortunate-python

2011-12-21 Thread Saju M
http://excess.org/article/2011/12/unfortunate-python/ -- Saju Madhavan s...@fluentsoft.com +91 09535134654 ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers

[BangPypers] UML diagrams from python source code

2011-12-15 Thread Saju M
Hi, I'm looking for a good tool that can automatically generatre UML diagrams from python source code. ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers

Re: [BangPypers] Sphinx inheritance-diagram Issue

2011-12-12 Thread Saju M
http://sphinx.pocoo.org/invocation.html#invocation-of-sphinx-apidoc On Mon, Dec 12, 2011 at 7:15 AM, Saju M wrote: > Hi, > Issue solved by adding "sphinx.ext.inheritance_diagram" to your > conf.py - extensions > > On Mon, Dec 12, 2011 at 6:05 AM, Saju M wrote: >> I

Re: [BangPypers] Sphinx inheritance-diagram Issue

2011-12-12 Thread Saju M
Hi, Issue solved by adding "sphinx.ext.inheritance_diagram" to your conf.py - extensions On Mon, Dec 12, 2011 at 6:05 AM, Saju M wrote: > I created complete API documentation using sphinx. > Command i used are: > $ sphinx-apidoc -f -F -o . /home/sam/CMS > $ make html >

[BangPypers] Sphinx inheritance-diagram Issue

2011-12-12 Thread Saju M
I created complete API documentation using sphinx. Command i used are: $ sphinx-apidoc -f -F -o . /home/sam/CMS $ make html Then i planned to add inheritance-diagram of classes, for that i edited "provider.rst" file and added two new lines as shown below. provider diagram .. inhe

[BangPypers] Documentation using Sphinx

2011-12-08 Thread Saju M
Hi, I am trying source code documentation using Sphinx. Here i have to copy paste all modules in to *.rst file, that is painful. Have any way to create documentation (doc for all modules, classes and methods in the project directory) from project folder quickly. I also plannig to add a code browsin

Re: [BangPypers] howto Sqlalchemy atomic transaction ??

2011-11-21 Thread Saju M
Model class VDCTemplates(DeclarativeBase): __tablename__='cd_vdc_templates' id = Column(Unicode(50), primary_key=True) vdc_id=Column(Unicode(50), ForeignKey('cd_vdc.id', ondelete="CASCADE")) template_id=Column(Unicode(50), ForeignKey('cd_account_templates.id', ondelete="CAS

[BangPypers] howto Sqlalchemy atomic transaction ??

2011-11-20 Thread Saju M
Hi, http://dpaste.com/659618/ ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers

[BangPypers] Selenium pyvirtualdisplay Script suggestions to improve

2011-10-06 Thread Saju M
Hi Friends, Here is the code for change "Custom Location" in google search page http://dpaste.com/629298/ log http://dpaste.com/629304/ I could run it on Remote Server. But its not working sometimes, because selenium can't find some elements on the page, So that i added a "while" loop for retry

[BangPypers] selenium pyvirtualdisplay script on remote server

2011-10-05 Thread Saju M
Hi friends, selenium pyvirtualdisplay script on remote server Here the isuue is i can't find the "li" element. that is because that element is out of display, so i adjust scroll bar or do focus around that area to get that element via find_element_by_id("loc_opt") I already tested with scroll ba

Re: [BangPypers] selenium click not working fot some links

2011-10-04 Thread Saju M
I could find that some padding is given for that link, is that the issue ?? ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers

[BangPypers] selenium click not working fot some links

2011-10-04 Thread Saju M
I created a selenium script in python as follows loc_link = self.driver.find_element_by_id("tbpi") print "--loc_link---", loc_link.tag_name, loc_link.text loc_link.click() i want to click on link 'More search tools'. Tsis script printing element name 'a' and text 'More search tools' corre

Re: [BangPypers] Howto run python selenium script on remote server

2011-09-29 Thread Saju M
Hi, I tried to open one GUI app in server, but not working [root@c5 ~]# export DISPLAY=":1.0" [root@c5 ~]# xclock Error: Can't open display: :1.0 [root@c5 ~]# export DISPLAY=":0.0" [root@c5 ~]# xclock Error: Can't open display: :0.0 [root@c5 ~]# ps -ef | grep X root 3900 3897 0 11:18 t

Re: [BangPypers] Howto run python selenium script on remote server

2011-09-29 Thread Saju M
Hi Balachandran Sivakumar, Thanks for reply * Yes is can see the firefox command on remote server's terminal. * I think remote server does not have GUI, so is it possible to run firefox. * When i run #firefox on remote server it not showing Error: no display specified. >>Does the remote machine

Re: [BangPypers] BangPypers Digest, Vol 49, Issue 32

2011-09-29 Thread Saju M
st..." > > > Today's Topics: > >   1. Howto run python selenium script on remote server (Saju M) >   2. Re: Howto run python selenium script on remote server >      (Balachandran Sivakumar) > > > ----

[BangPypers] Howto run python selenium script on remote server

2011-09-29 Thread Saju M
Hi, I created a script using selenium and its working in my local system. But when i trying to run it in remote machine (Centos), getting error. This script should need to open a firefox browser. So i think the the script could not open the firefox browser on remote machine(Server). Have any way to

[BangPypers] RE : Python mechanize Change the Location of Google search

2011-09-15 Thread Saju M
in open File "build/bdist.linux-i686/egg/mechanize/_mechanize.py", line 255, in _mech_open mechanize._response.httperror_seek_wrapper: HTTP Error 404: Not Found === Date: Wed, 14 Sep 2011 16:31:49 +0530 From: Saju M To: bangpypers@python.org Subject: [BangPypers] P

[BangPypers] Python mechanize Change the Location of Google search

2011-09-14 Thread Saju M
I want to open Google search page and Change the Location link in the left hand nav of Google) from the users current location to a different location, then return the results of the updated search. I done following coding. Issue is, Left side Change Location form of google is javacript driven, So

[BangPypers] [commercial] python/django training

2011-05-12 Thread Saju M
Hi, I think 25k is too high !!! > hi, > > there is a large demand for python/django programmers, and I am getting > constant requests for candidates. I had tried to interest some > institutes in training, but most of them are unprofessional and provide > mere theoretical knowledge. Companies that