Re: how to call java methods in python

2011-10-03 Thread alex23
On Oct 4, 4:39 pm, masood shaik wrote: > Please help me. Please help us help you. You've given us nothing but an error message. (Which seems to indicate that you're trying 'import Calculator'...) What are you using to call Java methods in Python? Can you provide a small example of code that dem

how to call java methods in python

2011-10-03 Thread masood shaik
Hi I am trying to import java method in python. But i am getting the following error. error: ImportError: No module named Calculator Calculator is the name of the class written in java. I am trying to access the methods of that class. Please help me. -- http://mail.python.org/ma

Re: Chaos Theory [was Re: Benefit and belief]

2011-10-03 Thread alex23
Zero Piraeus wrote: > A dissenting view [and a Kill Bill spoiler, of sorts]: > > http://www.youtube.com/watch?v=PdWF7kd1tNo A fun diatribe, sure, but still an outsider view that is in direct conflict with how the characters are actually portrayed. -- http://mail.python.org/mailman/listinfo/pytho

Re: Suggested coding style

2011-10-03 Thread Stephen Hansen
On 9/30/11 6:54 AM, rantingrick wrote: > a misplaced and rarely used functionality of the stdlib. Have you tried putting "\.zfill\(" and selecting Python in google.com/codesearch? It seems to have quite a few users, among only openly available code. Considering there is a much larger body of code

Re: Chaos Theory [was Re: Benefit and belief]

2011-10-03 Thread Zero Piraeus
: On 4 October 2011 00:43, alex23 wrote: > rantingrick wrote: >> Clark Kent is just an assumed identity of Superman. > > Actually, he identifies with Clark Kent, Superman is the secret > identity. > > You're thinking of Batman, for whom Bruce Wayne is the mask. A dissenting view [and a Kill Bil

Re: Chaos Theory [was Re: Benefit and belief]

2011-10-03 Thread alex23
rantingrick wrote: > TrueWiseObserver: Wrong pseudo. Superman will ALWAYS be superman even > if he wears a dress and stilettos. Clark Kent is just an assumed > identity of Superman. Actually, he identifies with Clark Kent, Superman is the secret identity. You're thinking of Batman, for whom Bruc

Re: Is it possible to create C-style "main" function in Python? (for teaching purposes)

2011-10-03 Thread alex23
Sorry for hijacking Alec's response but I didn't see the OP. > Aivar Annamaa wrote: > > I'm looking for a trick or hidden feature to make Python 3 automatically > > call a "main" function but without programmers writing `if __name__ == > > "__main__": ...` One direct way is to call it from the c

Re: Is it possible to create C-style "main" function in Python? (for teaching purposes)

2011-10-03 Thread alex23
rantingrick wrote: > Why? Well because many times i find myself wondering if this or that > variable is local or global -- and when i say "global" i am speaking > of module scope! The "global" cures the ill. Given your stated propensity for huge code blocks not chunked into functions, I'm not sur

Re: To start a simple server

2011-10-03 Thread sillyou su
On Oct 4, 2:15 am, Amelia T Cat wrote: > On Mon, 03 Oct 2011 10:09:59 -0700, sillyou su wrote: > > 啊!! > > > I should use 127.0.0.1 instance of  0.0.0.0 > > Theoretically either one should be fine. If you use 127.0.0.1 it will > only expose the service to your local machine. If you use 0.0.0.0 ut

Re: Python Migration Error: TypeError: exceptions must be old-style classes or derived from BaseException, not str

2011-10-03 Thread rusi
On Oct 3, 12:45 pm, Chris Rebert wrote: > On Sun, Oct 2, 2011 at 11:45 PM, Wong Wah Meng-R32813 > > wrote: > > Hello guys, > > > I am migrating my application from python 1.5.2 to 2.7.1. I encountered an > > error when I run some commands (I put in debug statement however, not able > > to trace

Re: Is it possible to create C-style "main" function in Python? (for teaching purposes)

2011-10-03 Thread Roy Smith
In article , Ian Kelly wrote: > It's not a good idea to teach bad habits they'll just have to unlearn > later on. Absolutely correct. People who teach teachers how to teach call this the Law of Primacy (http://en.wikipedia.org/wiki/Principles_of_learning#Primacy), and (despite a lot of the

Re: Python without a tty

2011-10-03 Thread Nobody
On Mon, 03 Oct 2011 22:04:26 +1300, Gregory Ewing wrote: >> os.setsid() > > *This* is what's losing the tty. According to the Fine Man Page: > > DESCRIPTION > The setsid function creates a new session. The calling process is the > session leader of the new session, is the process g

Re: Is it possible to create C-style "main" function in Python? (for teaching purposes)

2011-10-03 Thread Chris Angelico
On Tue, Oct 4, 2011 at 9:41 AM, Ian Kelly wrote: > def add_from_input(num_lines): >    total = global.sum(global.int(global.input()) for i in > global.range(num_lines)) >    global.print("The total is", total) That's pretty unfair to the globals. def add_from_input(param.num_lines): local.tot

Re: Question: How to Prevent Tkinter Menu from Taking Keyboard Focus

2011-10-03 Thread galyle
On Oct 3, 2:40 pm, rantingrick wrote: > On Oct 3, 2:55 pm, galyle wrote: > > > Hello, I'm trying to build a menu which provides suggestions to a user > > based on input to an entry.  I have done something like this before > > using Tcl/Tk, so I expected that it would work without much difficulty

Re: Advise on using logging.getLogger needed.

2011-10-03 Thread Gelonida N
On 10/03/2011 12:12 AM, Steven W. Orr wrote: > I hope I don't sound like I'm ranting :-( > > I have created a module (called xlogging) which sets up logging the way I want > it. I found out that if I set up my logger without a name, then it gets > applied to every logger that is referenced by ever

Re: overloading operators for a function object

2011-10-03 Thread Westley Martínez
On Fri, Sep 30, 2011 at 09:50:42PM -0700, Fletcher Johnson wrote: > Is it possible to overload operators for a function? > > For instance I would like to do something roughly like... > > def func_maker(): > def func(): pass > > def __eq__(other): > if other == "check": return True >

Re: Is it possible to create C-style "main" function in Python? (for teaching purposes)

2011-10-03 Thread Ian Kelly
On Mon, Oct 3, 2011 at 2:10 PM, rantingrick wrote: > Also for scoping. > > py> count = 0 > py> def foo(): > ...     global.count += 1 > py> print count > 1 > > Why? Well because many times i find myself wondering if this or that > variable is local or global -- and when i say "global" i am speakin

Re: Is there any way to access attributes from an imported module?

2011-10-03 Thread Rhodri James
On Mon, 03 Oct 2011 03:21:41 +0100, Andrew Berg wrote: I found a way to do it, albeit a very hackish one. Since the class instance already catches exceptions from the modules it imports, I can make a custom exception (in a common area for both it and the submodules to import) for it to catch

Re: Is it possible to create C-style "main" function in Python? (for teaching purposes)

2011-10-03 Thread Dave Angel
On 01/-10/-28163 02:59 PM, rantingrick wrote: On Oct 3, 2:14 pm, Dave Angel wrote: Like it or not, there are plenty of globals already there, one of them being __name__ . All the built-ins are effectively global, and so is any function they define at top-level. I keep wondering if that wa

Re: Is it possible to create C-style "main" function in Python? (for teaching purposes)

2011-10-03 Thread Gregory Ewing
Ian Kelly wrote: I would suggest giving them the whole if __name__ block as boilerplate and telling them they're not allowed to alter it. I would suggest not showing them "if __name__" at all; instead encourage them to do this: def main(): ... ... main() You only need "if __name

Re: Hello, and request for help with 'dynamic grids'

2011-10-03 Thread Ed Leafe
On Sep 5, 2011, at 8:33 AM, Simon Cropper wrote: > Dabo is a great product. Spoke extensively with Ed Leafe and Paul McNett. > Unfortunately the framework is not 'dynamic'. If you have an fixed database > and tables it can quite quickly create a basic data entry setup and menu. > Looks great wh

Re: HTTP Persistent connection

2011-10-03 Thread pedr0
Because I am a newbye!!! Thanks a lot for your answer! -- http://mail.python.org/mailman/listinfo/python-list

Re: Chaos Theory [was Re: Benefit and belief]

2011-10-03 Thread rantingrick
On Oct 3, 11:27 am, Chris Angelico wrote: > PhysicsExpert: Super-speed wouldn't work, the acceleration required to > achieve it would burn up his surroundings! For some definition of "super-speed" i suppose. Since we're bouncing around the "relatives" here we need to consider this one also -> Su

Re: HTTP Persistent connection

2011-10-03 Thread John Gordon
In <27527508.4070.1317674357487.JavaMail.geo-discussion-forums@yqnk41> pedr0 writes: > I forget to insert second request. > host = "www.higuys.net" > #first request > http_connection = httplib.HTTPConnection(host) > http_connection.request(method,url_first,headers=headers) > response = http_con

Re: Question: How to Prevent Tkinter Menu from Taking Keyboard Focus

2011-10-03 Thread rantingrick
On Oct 3, 2:55 pm, galyle wrote: > Hello, I'm trying to build a menu which provides suggestions to a user > based on input to an entry.  I have done something like this before > using Tcl/Tk, so I expected that it would work without much difficulty > with Tkinter.  I was wrong. Why not just use

Re: HTTP Persistent connection

2011-10-03 Thread pedr0
I forget to insert second request. host = "www.higuys.net" #first request http_connection = httplib.HTTPConnection(host) http_connection.request(method,url_first,headers=headers) response = http_connection.getresponse() #second request http_connection = httplib.HTTPConnection(host) http_connectio

HTTP Persistent connection

2011-10-03 Thread pedr0
Hi at all, I have some problem with the httplib module, I would like have an HTTP persistent connection but when run this code : #first request http_connection = httplib.HTTPConnection(host) http_connection.request(method,url,headers=headers) response = http_connection.getresponse() #second req

Re: Is it possible to create C-style "main" function in Python? (for teaching purposes)

2011-10-03 Thread rantingrick
On Oct 3, 2:14 pm, Dave Angel wrote: > Like it or not, there are plenty of globals already there, one of them > being __name__ .  All the built-ins are effectively global, and so >   is any function they define at top-level. I keep wondering if that was another PyWart? I believe (and hindsight i

Question: How to Prevent Tkinter Menu from Taking Keyboard Focus

2011-10-03 Thread galyle
Hello, I'm trying to build a menu which provides suggestions to a user based on input to an entry. I have done something like this before using Tcl/Tk, so I expected that it would work without much difficulty with Tkinter. I was wrong. The problem I have is that, as soon as the menu is posted, i

Re: Is it possible to create C-style "main" function in Python? (for teaching purposes)

2011-10-03 Thread Ian Kelly
On Mon, Oct 3, 2011 at 1:14 PM, Dave Angel wrote: > Is it explaining the if statement that's the problem?  If so, you could have > them do an unconditional main(sys.argv) at the bottom of their file, and not > bother putting an if statement in front of it.  Then when you get to > user-written modu

Re: Is it possible to create C-style "main" function in Python? (for teaching purposes)

2011-10-03 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Aivar Annamaa wrote: Hi! I'm looking for a trick or hidden feature to make Python 3 automatically call a "main" function but without programmers writing `if __name__ == "__main__": ...` I found rejected PEP 299, but i thought that maybe there's something new already.

Re: Re: packages, modules and double imports - oh my!

2011-10-03 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Chris Withers wrote: On 03/10/2011 11:22, Chris Rebert wrote: http://docs.python.org/library/runpy.html : "The runpy module['s] main use is to implement the -m command line switch" "If the supplied module name refers to a package rather than a normal module, then tha

Re: To start a simple server

2011-10-03 Thread Iuri
Something is running in your port 8080. Change the port and try again. On Mon, Oct 3, 2011 at 3:15 PM, Amelia T Cat wrote: > On Mon, 03 Oct 2011 10:09:59 -0700, sillyou su wrote: > > > 啊!! > > > > I should use 127.0.0.1 instance of 0.0.0.0 > > Theoretically either one should be fine. If you use

Re: Problem regarding command line completion

2011-10-03 Thread Peter Otten
Rajashree Thorat wrote: > Please can anyone help me in resolving following problem. > > import cmd > class CmdLineApp(cmd.Cmd): > > def do_grep(self, line): > print line > > option = ["--ignore-case", > "--invert-match","--word-regexp","--line-regexp"] >

Re: To start a simple server

2011-10-03 Thread Amelia T Cat
On Mon, 03 Oct 2011 10:09:59 -0700, sillyou su wrote: > 啊!! > > I should use 127.0.0.1 instance of 0.0.0.0 Theoretically either one should be fine. If you use 127.0.0.1 it will only expose the service to your local machine. If you use 0.0.0.0 ut will expose the service to other computers on t

Re: To start a simple server

2011-10-03 Thread Redcat
On Mon, 03 Oct 2011 10:05:15 -0700, sillyou su wrote: > I am running web.py on my computer Does "netstat -nat | grep 8080" show anything listening on port 8080? (I'm assuming here that you're running on a Linux box) -- http://mail.python.org/mailman/listinfo/python-list

Re: To start a simple server

2011-10-03 Thread sillyou su
I am running web.py on my computer -- http://mail.python.org/mailman/listinfo/python-list

Re: TK + MVC

2011-10-03 Thread Emeka
Alex, The question was not meant for you. I was responding to Greg's comment. Regards, Emeka On Mon, Oct 3, 2011 at 12:14 AM, Alexander Kapps wrote: > On 03.10.2011 00:15, Emeka wrote: > >> Greg, >> >> Do you have an example where the Controller is connected? >> > > What do you mean? In my exa

Re: Is it possible to create C-style "main" function in Python? (for teaching purposes)

2011-10-03 Thread Alec Taylor
Make something with http://metapython.org/ ? On Tue, Oct 4, 2011 at 3:21 AM, Aivar Annamaa wrote: > Hi! > > I'm looking for a trick or hidden feature to make Python 3 automatically > call a "main" function but without programmers writing `if __name__ == > "__main__": ...` > > I found rejected PE

Re: Chaos Theory [was Re: Benefit and belief]

2011-10-03 Thread Chris Angelico
On Tue, Oct 4, 2011 at 2:54 AM, rantingrick wrote: > Observer: Why is it that Clark Kent and Superman are never in the same > place at the same time? > ComicFanboy: Because Clark Kent IS Kal-El's secret identity duh! > PuesdoWiseObserver: Wait a minute fanboy, they ARE in the same place > at the s

Is it possible to create C-style "main" function in Python? (for teaching purposes)

2011-10-03 Thread Aivar Annamaa
Hi! I'm looking for a trick or hidden feature to make Python 3 automatically call a "main" function but without programmers writing `if __name__ == "__main__": ...` I found rejected PEP 299, but i thought that maybe there's something new already. Here's why I want such a thing: I'm teaching intr

Re: Chaos Theory [was Re: Benefit and belief]

2011-10-03 Thread rantingrick
On Oct 2, 4:43 pm, Steven D'Aprano wrote: > In all cases, we can be sure that the contradiction between the pair of > statements are genuine contradictions and not mere apparent > contradictions caused by "narrow perspective" or incomplete or erroneous > knowledge. Observer: Why is it that Clark

Who Is Gary Sokolich? 1405

2011-10-03 Thread Gary Sokolisch
1405 W Gary Sokolich 801 Kings Road Newport Beach, CA 92663-5715 (949) 650-5379 http://web.archive.org/web/20080821231423/http://www.tbpe.state.tx.us/da/da022808.htm TEXAS BOARD OF PROFESSIONAL ENGINEERS February 28, 2008 Board Meeting Disciplinary Actions W. Gary Sokolich , Newport Beach,

Re: packages, modules and double imports - oh my!

2011-10-03 Thread Chris Withers
On 03/10/2011 11:22, Chris Rebert wrote: http://docs.python.org/library/runpy.html : "The runpy module['s] main use is to implement the -m command line switch" "If the supplied module name refers to a package rather than a normal module, then that package is imported and the __main__ submodule wi

Re: Advise on using logging.getLogger needed.

2011-10-03 Thread Jean-Michel Pichavant
Steven W. Orr wrote: I hope I don't sound like I'm ranting :-( I have created a module (called xlogging) which sets up logging the way I want it. I found out that if I set up my logger without a name, then it gets applied to every logger that is referenced by every module that ever gets imported

BaseHTTPServer ThreadMixIn not working

2011-10-03 Thread amit
Hi everyone, I am really stuck in a very simple problem and wanted to know if you could take some time to check it out - My code is simple. Using BaseHTTPServer and ThreadInMix I want to run a python script (Script1.py) for every request made simultaneously. My code-> from subprocess import PIPE

Re: To start a simple server

2011-10-03 Thread Redcat
Are you running web.py on your computer, or is it running for example on a hosting company's computer? If it's not on your computer you have your port 8080 traffic blocked the hosting company's firewall. On Sun, 02 Oct 2011 20:59:40 -0700, sillyou su wrote: > i am learning webpy and I am follow

Re: timedelta is squicking me out

2011-10-03 Thread Roy Smith
In article , Chris Rebert wrote: > If something involves Python and nontrivial chronology, then > mxDateTime is the go-to library. And indeed, it has a RelativeDateTime > type: > http://www.egenix.com/products/python/mxBase/mxDateTime/doc/#_Toc293683810 We've been using http://labix.org/python-

Re: lower-case names for builtin types

2011-10-03 Thread rantingrick
On Oct 1, 10:41 pm, Eric Snow wrote: > Anyone know the story behind the lower-case names for the > non-exception built-in types (like list and type)?  I am guessing that > they were originally factory functions that, at some point, graduated > to full types; and the names were kept lower-case for

Re: parse xml

2011-10-03 Thread Adam Tauno Williams
Quoting 守株待兔 <1248283...@qq.com>: please click the http://www.secinfo.com/d14qfp.q9j.htm then ,click the following: 44: XML IDEA: Condensed Consolidating Statements of Income XML 5.11M (Details)--R158 there is the citigroup's annual financial report --statements of income,xml file.

Problem regarding command line completion

2011-10-03 Thread Rajashree Thorat
Hi All, Please can anyone help me in resolving following problem. import cmd class CmdLineApp(cmd.Cmd): def do_grep(self, line): print line option = ["--ignore-case", "--invert-match","--word-regexp","--line-regexp"] def complete_grep(self, text, line, be

Re: packages, modules and double imports - oh my!

2011-10-03 Thread Chris Rebert
On Mon, Oct 3, 2011 at 3:11 AM, Chris Withers wrote: > Hi All, > > The attached package gives that smallest possible example of problems I'm > hitting with some SQLAlchemy declarative classes. > > In short, I want to be able to do: > > python -m pack.module and have if the __name__=='__main__' blo

packages, modules and double imports - oh my!

2011-10-03 Thread Chris Withers
Hi All, The attached package gives that smallest possible example of problems I'm hitting with some SQLAlchemy declarative classes. In short, I want to be able to do: python -m pack.module and have if the __name__=='__main__' block spit out the SQL to create the tables necessary for the modu

http://www.electronicswebworld.com/

2011-10-03 Thread deepika
http://www.electronicswebworld.com/ online jobs for u http://www.tamilwebworld.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Python without a tty

2011-10-03 Thread Gregory Ewing
Hegedüs wrote: If you fork() your process, then it will also loose the tty... Um, no, fork() doesn't do that, as far as I know. os.setsid() *This* is what's losing the tty. According to the Fine Man Page: DESCRIPTION The setsid function creates a new session. The calling process is

Re: Python Migration Error: TypeError: exceptions must be old-style classes or derived from BaseException, not str

2011-10-03 Thread Gregory Ewing
Wong Wah Meng-R32813 wrote: I am migrating my application from python 1.5.2 to 2.7.1. Does it mean in newer python I need to migrate all my Exception to non-string based exception type? That's should be a lot of changes. :p 'Fraid so. You are leaping quite a lot of versions at once, and str

Re: TK + MVC

2011-10-03 Thread Gregory Ewing
Alexander Kapps wrote: Sure, in that simple example the Controller is just there to show a complete MVC pattern with all three parts. There are often examples where the View is actually both, the View and the Controller. I think what I'm really trying to say is that this example is *poor* at

Re: Need A script to open a excel file and extract the data using autofilter

2011-10-03 Thread Adam Przybyla
Prakash wrote: > Need A script to open a excel file and extract the data using > autofilter and write it in a new sheet or new file like I have to > select all rows in which all the columns contain pass as status ... try this: http://www.python-excel.org/ Regards

Re: Change import order with *.pth files

2011-10-03 Thread Gabriel Genellina
En Sun, 02 Oct 2011 18:29:24 -0300, Andrea Gavana escribió: Let's say I am using a package called "blah", and this package is already installed on site-packages (and I need it to be there) with a name "blah-1.2-win". In the site-packages folder, there is a pth file called "blah.pth" which con

RE: Python Migration Error: TypeError: exceptions must be old-style classes or derived from BaseException, not str

2011-10-03 Thread Wong Wah Meng-R32813
I see. Thanks for the tips. If I run out of time I shall consider only using 2.5. Regards, Wah Meng -Original Message- From: python-list-bounces+wahmeng=freescale@python.org [mailto:python-list-bounces+wahmeng=freescale@python.org] On Behalf Of Steven D'Aprano Sent: Monday, Oc

RE: Python Migration Error: TypeError: exceptions must be old-style classes or derived from BaseException, not str

2011-10-03 Thread Wong Wah Meng-R32813
Noted. No choice then, I will convert all my raise statement to use the exception instance. Thanks! Regards, Wah Meng -Original Message- From: ch...@rebertia.com [mailto:ch...@rebertia.com] On Behalf Of Chris Rebert Sent: Monday, October 03, 2011 3:46 PM To: Wong Wah Meng-R32813 Cc: pyth

Re: Python without a tty

2011-10-03 Thread Hegedüs , Ervin
hello, On Mon, Oct 03, 2011 at 09:28:27AM +0200, Hans Mulder wrote: > On 3/10/11 08:10:57, Hegedüs, Ervin wrote: > > > >If you fork() your process, then it will also loose the tty... > > Errhm, I suggest you check again. This cannot be true. > > >os.setsid() > > It is os.setsid() that makes yo

Re: Python Migration Error: TypeError: exceptions must be old-style classes or derived from BaseException, not str

2011-10-03 Thread Chris Rebert
On Sun, Oct 2, 2011 at 11:45 PM, Wong Wah Meng-R32813 wrote: > Hello guys, > > I am migrating my application from python 1.5.2 to 2.7.1. I encountered an > error when I run some commands (I put in debug statement however, not able to > trace down to which line of code that cause it to generate a

Re: Python Migration Error: TypeError: exceptions must be old-style classes or derived from BaseException, not str

2011-10-03 Thread Steven D'Aprano
On Mon, 03 Oct 2011 06:45:25 +, Wong Wah Meng-R32813 wrote: > Does it mean in newer python I need to migrate all my Exception to > non-string based exception type? That's should be a lot of changes. :p Yes. Python 1.5 is very old. It's over 11 years old. You might find it easier to first m

Re: executing arbitrary statements

2011-10-03 Thread Jonathan Hartley
Fair points Steven. Thanks for further refining my initial refinement. :-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Python without a tty

2011-10-03 Thread Hans Mulder
On 3/10/11 08:10:57, Hegedüs, Ervin wrote: hello, On Mon, Oct 03, 2011 at 04:37:43AM +, Steven D'Aprano wrote: I wanted to ensure that it would do the right thing when run without a tty, such as from a cron job. If you fork() your process, then it will also loose the tty... Errhm, I su