Re: Is Python like VB?
On 18 Mar 2005 07:22:05 -0800, scattered [EMAIL PROTECTED] wrote: Tim Roberts wrote: Mike Cox [EMAIL PROTECTED] wrote: As you may or may not know, Microsoft is discontinuing Visual Basic in favor of VB.NET and that means I need to find a new easy programming language. I heard that Python is an interpreted language similar to VB. This statement is a little bit silly. VB.NET is an interpreted language which is practically indistinguishable from the old VB. Why on earth would you choose to reimplement your software in a different language, rather than just do the simple version upgrade? It is a bit OT for a python group, but calling VB.NET virtually indistinguishable from VB isn't fair to either language. The differences between them are so significant that many VB developers have taken to calling VB.Net visual fred instead ( http://vb.mvps.org/vfred/breaks.asp ). VB.Net is both more powerful and less convienent than VB. You are right that VBA isn't being discontinued yet. My own interest in learning python is to find a replacement for Excel VBA. I'm a mathematician who likes to throw quick programs together for things like statistical simulations. I liked the ability to get functioning code quickly in VBA, together with the ability to easily generate graphs of the results, etc., but I finally got tired of the slow speed and verbose syntax. I'm hoping that Python (as packaged by Enthought together with various numerical and graphing modules) will be an appropriate replacement. -scattered -- http://mail.python.org/mailman/listinfo/python-list I agree, VB.net is enough of a difference that I've found a lot of developers who only develop in VB6 get really tripped up in it for a while. Not to mention the framework you have access to is huge, leanring your way around that is a chore in itself. It takes a significant amount of effort to feel as productive in it as vb6. Especially if you've never been exposed to huge frameworks like VCL or Java or the .net framework. To imply that the transition from vb6 to vb.net is anything less than a significant effort is misleading to say the least. My .02 as a recovering vb6 com/dcom/asp programmer stuck on more than a few vb.net projects. -- Thomas G. Willis http://paperbackmusic.net -- http://mail.python.org/mailman/listinfo/python-list
Re: Is Python like VB?
On Fri, 18 Mar 2005 15:45:10 -0500, Tom Willis [EMAIL PROTECTED] wrote: On Fri, 18 Mar 2005 20:20:19 +, Steve Horsley [EMAIL PROTECTED] wrote: scattered wrote: You are right that VBA isn't being discontinued yet. My own interest in learning python is to find a replacement for Excel VBA. I'm a mathematician who likes to throw quick programs together for things like statistical simulations. I liked the ability to get functioning code quickly in VBA, together with the ability to easily generate graphs of the results, etc., but I finally got tired of the slow speed and verbose syntax. I'm hoping that Python (as packaged by Enthought together with various numerical and graphing modules) will be an appropriate replacement. Were you aware that OpenOffice.org version 2.0, which is due out soon (beta is available for download), can have python macros, as well as javascript and StarOffice Basic macros? Steve -- http://mail.python.org/mailman/listinfo/python-list http://udk.openoffice.org/python/scriptingframework/index.html Damn that's hot! I am tingly :) -- Thomas G. Willis http://paperbackmusic.net Reply to self... The API however, smells more like java to me than python. Alas, I will happily use it for many of my needs. http://udk.openoffice.org/python/scriptingframework/dynamicDialog.py Perhaps OppenOffice.org 2.0 could be the postscript - pdf - text with the correct layout solution I've been hoping could replace a chain of very troublesome pieces of shareware. -- Thomas G. Willis http://paperbackmusic.net -- http://mail.python.org/mailman/listinfo/python-list
Re: Is Python like VB?
On Fri, 18 Mar 2005 20:20:19 +, Steve Horsley [EMAIL PROTECTED] wrote: scattered wrote: You are right that VBA isn't being discontinued yet. My own interest in learning python is to find a replacement for Excel VBA. I'm a mathematician who likes to throw quick programs together for things like statistical simulations. I liked the ability to get functioning code quickly in VBA, together with the ability to easily generate graphs of the results, etc., but I finally got tired of the slow speed and verbose syntax. I'm hoping that Python (as packaged by Enthought together with various numerical and graphing modules) will be an appropriate replacement. Were you aware that OpenOffice.org version 2.0, which is due out soon (beta is available for download), can have python macros, as well as javascript and StarOffice Basic macros? Steve -- http://mail.python.org/mailman/listinfo/python-list http://udk.openoffice.org/python/scriptingframework/index.html Damn that's hot! I am tingly :) -- Thomas G. Willis http://paperbackmusic.net -- http://mail.python.org/mailman/listinfo/python-list
Re: Good use for Jython
On 15 Mar 2005 23:54:16 -0800, Mike Wimpe [EMAIL PROTECTED] wrote: Other than being used to wrap Java classes, what other real use is there for Jython being that Python has many other GUI toolkits available? Also, these toolkits like Tkinter are so much better for client usage (and faster) than Swing, so what would be the advantage for using Jython? or Is Jython really just so that Java developers can write Java code faster? Mike Wimpe -- http://mail.python.org/mailman/listinfo/python-list I haven't done anything substatial with Jython yet, but I consder it to be valuable in areas where you have to do something quick and dirty, perhaps debug an EJB running on an app server for example. Bean shell serves the same purpose and the syntax is pretty much Java so the learning curve isn't as steep for java developers. I see it as a way of getting around some of the requirements of the language. If I needed to connect to java systems together and I needed to do it quickly, and the quality of requirements was less than adequate, I'd rather write a script(beanshell/jython/groovy) than booting up eclipse and contributing to the interface cesspool . -- Thomas G. Willis http://paperbackmusic.net -- http://mail.python.org/mailman/listinfo/python-list
Re: About Databases...
On Fri, 11 Mar 2005 23:32:48 +0100, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello NG, I am still quite a newbie with Python (I intensely use wxPython, anyway). I would like to know what are, in your opinions, the best/faster databases that I could use in Python (and, of course, I should be able to link everything with a wxPython GUI)? Specifically, I work on Reservoir Simulation, and usually I have to store a discrete/huge amount of data (it depends on the oil field). As you may have understood, I know almost NOTHING about databases ;-) In general, my data will be numeric (floats, integers). Will a binary storage (if it is possible) reduce the size of the DB? And what about speed in storing/retrieving data? Thank you a lot for every suggestion. Andrea. -- http://mail.python.org/mailman/listinfo/python-list Whoa, you are asking alot. Without knowing anything about your requirements except what was mentioned in your post. I would say you would quite possibly want the functionality of a relational database. I'm assuming that these large amounts of data you will want to store effeciently and have some way of pulling it back out and arranging it in various ways(restricting results, order by fields etc...) For that you are going to have to learn another language besides python, but it's not that hard. I'm talking about SQL. Anyway, there lots of Releational Databases, some free some not. They all have their strengths and weakenesses. And everyone has their preferences. Mysql and postgresql are open source databases that run on a variety of platforms. I know you can talk to MySQL through Python, pretty sure you can talk to postgresql as well. MS SQL Server, and Oracle are 2 popular commercial DB's they cost money. I know nothing about Oracle, but, I have managed to get data in and out of MS SQL databases, through the MDAC api that's provided on windows. There may be other ways. Anyway, you would probably be best served doing some googling, because you may have a lot of noise coming your way about databases. To some people, a DB server is a religion, a lover, and a way of life...I pity those people. :) -- Thomas G. Willis http://paperbackmusic.net -- http://mail.python.org/mailman/listinfo/python-list
Re: modifiable config files in compiled code?
10 Mar 2005 06:02:22 -0800, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi All, I've been trying to come up with an elegant solution to this problem, but can't seem to think of anything better than my solution below. I have a Python program that needs to be converted into an executable. The problem is that I have a config template file that I've been using to modify initialization constants such as paths, global variables, structures, etc. Obviously, once I convert my code into an executable I can no longer read/write to my configuration file. My solution was to convert this config file into a standard ASCII text document and have Python parse it for user set variables. This doesn't seem like the most elegant of solutions; however, and I thought others must have implemented a better way than this. Anyone have a better solution for this problem? Jay -- http://mail.python.org/mailman/listinfo/python-list Don't know if you knew about this. #example from ConfigParser import ConfigParser def getconfig(): initialize configuration settings result = ConfigParser() result.read(config.ini) return result def main(): runs the app config = getconfig() ... dbsettings = {} for key,value in config.items(db): print %s: %s % (key,value) #etc... #---config.ini-- ;db settings [db] server = 127.0.0.1 db = db user = user password = password #end config.ini There are other projects for dealing with config information but ConfigParser is included wth python I think. Hope that helps... -- Thomas G. Willis http://paperbackmusic.net -- http://mail.python.org/mailman/listinfo/python-list
Re: modifiable config files in compiled code?
On Thu, 10 Mar 2005 13:01:28 -0500, Steve Holden [EMAIL PROTECTED] wrote: Larry Bates wrote: Note: my comments assume Windows distribution. Why do you think you can't you have a config file after you convert your program to an executable? I do it all the time and so do many I suspect the OP's config file is a Python module. regards Steve -- http://mail.python.org/mailman/listinfo/python-list That's what was thinking when I posted my response. -- Thomas G. Willis http://paperbackmusic.net -- http://mail.python.org/mailman/listinfo/python-list
Re: modifiable config files in compiled code?
ConfigParser works on linux I'm pretty sure. I just ran Ipython imported it and loaded a config file. I don't remember anything in the docs that said otherwise. I would prefer an xml style config file myself. But I can get by with and ini right now. The logging framework seems to me to be the hairiest configurations and it's able to work in an ini format. If I need anything fancier than that, I might consider doing it for a living and getting someone to pay me to compe up with it. :) On 10 Mar 2005 19:34:46 -0800, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Since this utility will also be ported to the linux world, does anyone know what the linux/unix counterpart of a Windows .INI configuration file is? I suppose I could get away with using XML for my config files and avoid having two different tools altogether. -- http://mail.python.org/mailman/listinfo/python-list -- Thomas G. Willis http://paperbackmusic.net -- http://mail.python.org/mailman/listinfo/python-list
windows bat file question
I'm trying to get pylint running on windows and the bat file for it seems a little screwy. I'm hoping someone may have figured this out already. rem = -*-Python-*- script @echo off rem DOS section rem You could set PYTHONPATH or TK environment variables here python %* goto exit # Python section import sys from logilab.pylint import lint lint.Run(sys.argv[1:]) DosExitLabel = :exit rem All I get is the python prompt, the lines starting at import sys don't run. If I throw the lines in a python script, I run into path issues. The overall effect I'm trying to achieve is c:\Projects\myproject\pylint mymodule.py Any ideas? -- Thomas G. Willis http://paperbackmusic.net -- http://mail.python.org/mailman/listinfo/python-list
Re: windows bat file question
On Tue, 01 Mar 2005 10:12:29 -0500, Peter Hansen [EMAIL PROTECTED] wrote: Tom Willis wrote: I'm trying to get pylint running on windows and the bat file for it seems a little screwy. I'm hoping someone may have figured this out already. ... All I get is the python prompt, the lines starting at import sys don't run. If I throw the lines in a python script, I run into path issues. What exact command are you typing to try to run it? Where is the script relative to the current directory?(Best is to cut and paste a copy of the actual command line and result that you have in your console.) On the topic of the path issues in the other case, what do you mean by path issues? DOS path issues? sys.path issues? Something else? What issues exactly... -Peter -- http://mail.python.org/mailman/listinfo/python-list I figured it out. I just took the embedded python code that was in the batch file distributed with it and put it in it's own module. Really my question was how would this ever work? It seems to me to be a little screwy, but it would be handy to know if this was some sort of convention that I could take advantage of if I ever write something substantial that would need to run on windoze. REM---bat file--- rem = -*-Python-*- script @echo off rem DOS section rem You could set PYTHONPATH or TK environment variables here python %* goto exit # Python section print hello from python DosExitLabel = :exit rem REM---end of bat file--- I'm wondering if this took advantage of some flaw in batch file processing that can no longer be used because of some security hole that got plugged or something. -- Thomas G. Willis http://paperbackmusic.net -- http://mail.python.org/mailman/listinfo/python-list
Re: Dealing with config files what's the options
On Fri, 25 Feb 2005 15:02:04 -0700, Dave Brueck [EMAIL PROTECTED] wrote: Jorgen Grahn wrote: On Tue, 22 Feb 2005 20:38:28 -0500, Tom Willis [EMAIL PROTECTED] wrote: How are the expert pythoneers dealing with config files? ... Any ideas? How about writing them in Python? Depending on who will be editing the config files, this can be a great approach. At the simplest level, a config.py file like this is so easy to use: # Net settings timeoutSec = 5.3 maxConnections = 3 # Other stuff foo = 'bar' This type of a format is easy to use for just about anybody who has ever had to use config files before. What's nice is that the code to use it is straightforward too: import config conn = config.maxConnections ... A few times I've tried to use accessor functions to ensure that the values are present or valid or whatever, but I stopped doing that because in practice it's just not needed (again, for users who are familiar with the concept of config files). A slightly more elaborate approach gives you full structure: class Net: maxConnections = 12 class System: class Logging: root = '/var/logs' This prevents individual setting names from getting unwieldy, and the code that uses it can be pretty readable too: logRoot = config.System.Logging.root or, if there are lots of retrievals to do: Logging = config.System.Logging logRoot = Logging.root ... etc ... Using classes asks a little bit more of the users (they can break it a little more easily), but again, in practice it really hasn't been a problem at all. -Dave -- http://mail.python.org/mailman/listinfo/python-list I actually thought of this, and I was kind of on the fence due to the intended audience. I don't think it's too much to ask that they are comfy with the concept of variables. I mean, if it was a shell script they'd be at the top of the file anyway. Then again I'm some what hesitant to help them make the connection that I'm giving them the ability to indirectly edit the code. Kind of like opening pandoras box. Once the figure out they can open any file (*.py) with notepad, there will be utter anarchy and I'll get the call at 4am that somethings wrong with the production data. -- Thomas G. Willis http://paperbackmusic.net -- http://mail.python.org/mailman/listinfo/python-list
Re: python tutorial/projects
On 24 Feb 2005 02:06:24 -0800, Fuzzyman [EMAIL PROTECTED] wrote: I'm looking for people to work on a couple of projects... online bookmarks manager for example Regards, Fuzzy http://www.voidspace.org.uk/python/index.shtml -- http://mail.python.org/mailman/listinfo/python-list How bout a paying full time job doing python development. In Cincinnati. That would rule. I only hear about vb.net or java around here. It's quite depressing. -- Thomas G. Willis http://paperbackmusic.net -- http://mail.python.org/mailman/listinfo/python-list
Re: Interesting decorator use.
On Thu, 24 Feb 2005 11:15:07 -0800, Scott David Daniels [EMAIL PROTECTED] wrote: I have started doing the following to watch for exceptions in wxPython. I'd like any input about (A) the interface, and (B) the frame before I throw it in the recipes book. import wx, os, sys errorframe = None def watcherrors(function): '''function decorator to display Exception information.''' def substitute(*args, **kwargs): ... Pretty cool. Question on decorators in general. Can you parameterize those? If I wanted to something and after the function call for example, I would expect something like this would work. def prepostdecorator(function,pre,post): def wrapper(*args,**kwargs): pre() result = function(*args,**kwargs) post() return result return wrapper def dopre(): print call pre def dopost(): print call post @prepostdecorator(pre,post) def sayhello(Name): print Hey %s, nice to meet you % Name #sayhello = prepostdecorator(sayhello,dopre,dopost) if __name__==__main__: sayhello(Dude) but I get ... TypeError: prepostdecorator() takes exactly 3 arguments (2 given) Where as def prepostdecorator(function,pre,post): def wrapper(*args,**kwargs): pre() result = function(*args,**kwargs) post() return result return wrapper def dopre(): print call pre def dopost(): print call post def sayhello(Name): print Hey %s, nice to meet you % Name sayhello = prepostdecorator(sayhello,dopre,dopost) if __name__==__main__: sayhello(Dude) #outputs call pre Hey Dude, nice to meet you call post Does what I want. I guess I'm having problems with how function get's in there similair to how self magically gets in a method, except when you specify other params. Got linky? -- Thomas G. Willis http://paperbackmusic.net -- http://mail.python.org/mailman/listinfo/python-list
Re: Interesting decorator use.
On Thu, 24 Feb 2005 15:00:46 -0700, Steven Bethard [EMAIL PROTECTED] wrote: Tom Willis wrote: Question on decorators in general. Can you parameterize those? If I wanted to something and after the function call for example, I would expect something like this would work. def prepostdecorator(function,pre,post): def wrapper(*args,**kwargs): pre() result = function(*args,**kwargs) post() return result return wrapper def dopre(): print call pre def dopost(): print call post @prepostdecorator(pre,post) def sayhello(Name): print Hey %s, nice to meet you % Name #sayhello = prepostdecorator(sayhello,dopre,dopost) if __name__==__main__: sayhello(Dude) but I get ... TypeError: prepostdecorator() takes exactly 3 arguments (2 given) You get this TypeError for the same reason that I get the following TypeError: py def prepostdecorator(function, pre, post): ... pass ... py prepostdecorator(1, 2) Traceback (most recent call last): File interactive input, line 1, in ? TypeError: prepostdecorator() takes exactly 3 arguments (2 given) The expression after @ is a _normal Python expression_. So since you couldn't call prepostdecorator with 2 arguments in any other situation, you still can't. If you want to call prepostdecorator with 2 arguments, you need to write it this way. A few options: (1) Use nested functions: py def prepostdecorator(pre,post): ... def decorator(function): ... def wrapper(*args,**kwargs): ... pre() ... result = function(*args,**kwargs) ... post() ... return result ... return wrapper ... return decorator ... py @prepostdecorator(dopre, dopost) ... def sayhello(name): ... print Hey %s, nice to meet you % name ... py sayhello('Tom') call pre Hey Tom, nice to meet you call post (2) Use functional.partial (PEP 309[1]) py def prepostdecorator(pre, post, function): ... def wrapper(*args,**kwargs): ... pre() ... result = function(*args,**kwargs) ... post() ... return result ... return wrapper ... py @partial(prepostdecorator, dopre, dopost) ... def sayhello(name): ... print Hey %s, nice to meet you % name ... py sayhello('Tom') call pre Hey Tom, nice to meet you call post (3) Use a class: py class prepostdecorator(object): ... def __init__(self, pre, post): ... self.pre, self.post = pre, post ... def __call__(self, function): ... def wrapper(*args,**kwargs): ... self.pre() ... result = self.function(*args,**kwargs) ... self.post() ... return result ... return wrapper py @prepostdecorator(dopre, dopost) ... def sayhello(name): ... print Hey %s, nice to meet you % name ... py sayhello('Tom') call pre Hey Tom, nice to meet you call post Note that in all of the above cases, the result of evaluating the expression after the @ is a callable object that takes _exactly one_ argument, the function to be decorated. HTH, STeVe [1] http://www.python.org/peps/pep-0309.html -- http://mail.python.org/mailman/listinfo/python-list Wow thanks for the explanation!! Some of it is a bit mind bending to me at the moment , but I'm going to mess with it a bit. -- Thomas G. Willis http://paperbackmusic.net -- http://mail.python.org/mailman/listinfo/python-list
Re: Interesting decorator use.
On Thu, 24 Feb 2005 15:20:30 -0700, Steven Bethard [EMAIL PROTECTED] wrote: Tom Willis wrote: Question on decorators in general. Can you parameterize those? Wow thanks for the explanation!! Some of it is a bit mind bending to me at the moment , but I'm going to mess with it a bit. Oh, I also should have mentioned that there's some explanation at: http://www.python.org/peps/pep-0318.html Specifically on parameterizing: The current syntax also allows decorator declarations to call a function that returns a decorator: @decomaker(argA, argB, ...) def func(arg1, arg2, ...): pass This is equivalent to: func = decomaker(argA, argB, ...)(func) The rationale for having a function that returns a decorator is that the part after the @ sign can be considered to be an expression (though syntactically restricted to just a function), and whatever that expression returns is called. See declaration arguments [15]. But playing around with it is, IMHO, definitely the best way to figure it out. =) STeVe -- http://mail.python.org/mailman/listinfo/python-list Getting back to your recipe. Through the explanation of how to get parameters in there, I see how it is possible to get a logger in there. Pretty slick that python can have AOP-like features sort of out of the box. Thanks again, off to check out the link... -- Thomas G. Willis http://paperbackmusic.net -- http://mail.python.org/mailman/listinfo/python-list
Re: Dealing with config files what's the options
On Wed, 23 Feb 2005 20:15:47 +, Phil Jackson [EMAIL PROTECTED] wrote: Tom Willis [EMAIL PROTECTED] writes: How are the expert pythoneers dealing with config files? You could use the cPickle module if you don't mind your config files being unreadable by humans. There is also the shlex module for more powerful config file needs: http://docs.python.org/lib/module-shlex.html While I'm replying to you, would you mind if I take the opportunity to ask you to stop top-posting? Thanks, Phil -- http://mail.python.org/mailman/listinfo/python-list sigh I guess. It's just so inconvenient in gmail. But anything for you. I'll try to try. :) Thanks for the info. -- Thomas G. Willis http://paperbackmusic.net -- http://mail.python.org/mailman/listinfo/python-list
Re: searching pdf files for certain info
I tried that for something not python related and I was getting sporadic spaces everywhere. I am assuming this is not the case in your experience? On Tue, 22 Feb 2005 10:45:09 -0500, rbt [EMAIL PROTECTED] wrote: Andreas Lobinger wrote: Aloha, rbt wrote: Thanks guys... what if I convert it to PS via printing it to a file or something? Would that make it easier to work with? Not really... The classical PS Drivers (f.e. Acroread4-Unix print- ps) simply define the pdf graphics and text operators as PS commands and copy the pdf content directly. Wishing a happy day LOBI I downloaded ghostscript for Win32 and added it to my PATH (C:\gs\gs8.15\lib AND C:\gs\gs8.15\bin). I found that ps2ascii works well on PDF files and it's entirely free. Usage: ps2ascii PDF_file.pdf ASCII_file.txt However, bundling a 9+ MB package with a 5K script and convincing users to install it is another matter altogether. -- http://mail.python.org/mailman/listinfo/python-list -- Thomas G. Willis http://paperbackmusic.net -- http://mail.python.org/mailman/listinfo/python-list
Re: python tutorial/projects
I found this one helpful http://diveintopython.org/ and this one http://ibiblio.org/obp/thinkCS/python/english/ Just found this one http://hetland.org/python/instant-python and this page has links to many more. http://www.python.org/doc/Intros.html And because I'm a huge Bruce Eckel fan. Thinking in Python http://mindview.net/Books/TIPython It's old, but I still go through it every now and then. -- Thomas G. Willis http://paperbackmusic.net On Tue, 22 Feb 2005 16:48:48 -0700, Steve Juranich [EMAIL PROTECTED] wrote: I think the tutorial offered at www.python.org/tut/tut.html is as good a starting place as any. I wouldn't be able to suggest a non-trivial project without knowing more about your background. Can you do a flashcard program? recipe organizer? [EMAIL PROTECTED] client? (I think you see where this is going). Good luck. On Tue, 22 Feb 2005 15:23:37 -0800, Danny [EMAIL PROTECTED] wrote: Does anyone know of a good python tutorial? I was also looking for some non-trivial projects to do in python. Basically I would like to claim on my resume, that I know python, with out bad karma. Danny -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: python tutorial/projects
You know, I hate doing this I just remembered the Bruce Eckel book is a direct transaltion from THinking In Patterns for Java. And as such the example python code within the chapters is not even valid Python. If you're new to the language you'll get confused with the use of private and static thrown everywhere. It's still good information though. On Tue, 22 Feb 2005 18:56:24 -0500, Tom Willis [EMAIL PROTECTED] wrote: I found this one helpful http://diveintopython.org/ and this one http://ibiblio.org/obp/thinkCS/python/english/ Just found this one http://hetland.org/python/instant-python and this page has links to many more. http://www.python.org/doc/Intros.html And because I'm a huge Bruce Eckel fan. Thinking in Python http://mindview.net/Books/TIPython It's old, but I still go through it every now and then. -- Thomas G. Willis http://paperbackmusic.net On Tue, 22 Feb 2005 16:48:48 -0700, Steve Juranich [EMAIL PROTECTED] wrote: I think the tutorial offered at www.python.org/tut/tut.html is as good a starting place as any. I wouldn't be able to suggest a non-trivial project without knowing more about your background. Can you do a flashcard program? recipe organizer? [EMAIL PROTECTED] client? (I think you see where this is going). Good luck. On Tue, 22 Feb 2005 15:23:37 -0800, Danny [EMAIL PROTECTED] wrote: Does anyone know of a good python tutorial? I was also looking for some non-trivial projects to do in python. Basically I would like to claim on my resume, that I know python, with out bad karma. Danny -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list -- Thomas G. Willis http://paperbackmusic.net -- http://mail.python.org/mailman/listinfo/python-list
Re: searching pdf files for certain info
Well sporadic spaces in strings would cause problems would it not? an example The String: Patient Face Sheet---pdftotext---P a tie n t Face Sheet I'm just curious if you see anything like that, since I really have no clue about ps or pdf etc...but I have a strong desire to replace a really flaky commercial tool. And if I can do it with free stuff, all the better my boss will love me. On Tue, 22 Feb 2005 11:31:16 -0500, rbt [EMAIL PROTECTED] wrote: Tom Willis wrote: I tried that for something not python related and I was getting sporadic spaces everywhere. I am assuming this is not the case in your experience? On Tue, 22 Feb 2005 10:45:09 -0500, rbt [EMAIL PROTECTED] wrote: Andreas Lobinger wrote: Aloha, rbt wrote: Thanks guys... what if I convert it to PS via printing it to a file or something? Would that make it easier to work with? Not really... The classical PS Drivers (f.e. Acroread4-Unix print- ps) simply define the pdf graphics and text operators as PS commands and copy the pdf content directly. Wishing a happy day LOBI I downloaded ghostscript for Win32 and added it to my PATH (C:\gs\gs8.15\lib AND C:\gs\gs8.15\bin). I found that ps2ascii works well on PDF files and it's entirely free. Usage: ps2ascii PDF_file.pdf ASCII_file.txt However, bundling a 9+ MB package with a 5K script and convincing users to install it is another matter altogether. -- http://mail.python.org/mailman/listinfo/python-list For my purpose, it works fine. I'm searching for certain strings that might be in the document... all I need is a readable file. Layout, fonts and/or presentation is unimportant to me. -- http://mail.python.org/mailman/listinfo/python-list -- Thomas G. Willis http://paperbackmusic.net -- http://mail.python.org/mailman/listinfo/python-list
Re: searching pdf files for certain info
Ah that makes sense. I only see the behavior in pdftotext. ps2ascii doesn't give me the layout , which for my purposes, I certainly need. Thanks for the info, Looks like I'll keep searching for that silver bullet.:( On Tue, 22 Feb 2005 20:07:50 -0500, rbt [EMAIL PROTECTED] wrote: Tom Willis wrote: Well sporadic spaces in strings would cause problems would it not? an example The String: Patient Face Sheet---pdftotext---P a tie n t Face Sheet I'm just curious if you see anything like that, since I really have no clue about ps or pdf etc...but I have a strong desire to replace a really flaky commercial tool. And if I can do it with free stuff, all the better my boss will love me. No, I do not see that type of behavior. I'm looking for strings that resemble SS numbers. So my strings look like this: nnn-nn-. The ps2ascii util in ghostscript reproduces strings in the format that I expect. BTW, I'm not using pdftotext. I'm using *ps2ascii*. -- http://mail.python.org/mailman/listinfo/python-list -- Thomas G. Willis http://paperbackmusic.net -- http://mail.python.org/mailman/listinfo/python-list
Re: Dealing with config files what's the options
Thanks, I'm not too keen on the ini layout. But it's good to know it's there. On Wed, 23 Feb 2005 14:50:27 +1300, Tony Meyer [EMAIL PROTECTED] wrote: How are the expert pythoneers dealing with config files? [...] You can just import ConfigParser, or look at the various alternatives: http://www.python.org/moin/ConfigParserShootout =Tony.Meyer -- Thomas G. Willis http://paperbackmusic.net -- http://mail.python.org/mailman/listinfo/python-list
WebServices/SOAP/Zolera Arghhhhhhhhh!!!!!!...not so much
I am not a SOAP/Web Services expert!! But I had to interface with some webservice code here at work. I was reading on the net the complextypes didn't work or were finnicky etc Well I managed to get it to work on Zolera 1.7. First the code generated from the wsdl didn't work without some editing due to types being declared later in the file but referenced earlier, and being in different namespaces. The next hurdle was getting the request to serialize properly. My request consisted of some strings and a complextype which was nothing but strings accept for a date. The date serialization was throwing an error. There was an article on ibm dev works where they claimed to not be able to get it to work. So I tried some things def parsedatestring(datestr): #SQLServer Date Format delimited by space 1st part date (/) 2nd part time (:) dt = datestr.strip(').split( ) month,day,year = dt[0].split(/) hour,minute,second = dt[1].split(:) #this one works return datetime(int(year),int(month),int(day),int(hour),int(minute),int(second)).utctimetuple() #throws Exception Serializing demo xmlns=http://DefaultNamespace._birthDate, TypeError int argument required #return %s-%s-%s % (year,month,day) #throws error Exception Serializing demo xmlns=http://DefaultNamespace._birthDate, TypeError int argument required #return %s-%s-%sT%s:%s:%s % (year,month,day,hour,minute,second) #throws Exception Serializing demo xmlns=http://DefaultNamespace._birthDate, TypeError not all arguments converted during string formatting #return tuple((int(year),int(month),int(day),int(hour),int(minute),int(second))) #throws Exception Serializing demo xmlns=http://DefaultNamespace._birthDate, TypeError not all arguments converted during string formatting #return tuple((year,month,day,hour,minute,second)) #throws Exception Serializing demo xmlns=http://DefaultNamespace._birthDate, TypeError not all arguments converted during string formatting #return tuple((float(year),float(month),float(day),float(hour),float(minute),float(second))) #throws Exception Serializing demo xmlns=http://DefaultNamespace._birthDate, TypeError iteration over non-sequence #return datetime(int(year),int(month),int(day),int(hour),int(minute),int(second)) Call me stupid, but I could not find out anywhere in the ZLI docs, the web, code or anything that specified I pass a utctimetuple. As a client of the API, I would assume it would be converted for me if I pass a python object. Anyway, I'm not bitching so much about the api as I am making an effort to get this out there on the web just in case someone else is hitting a brick wall on webservice interaction with python. I'm not convinced that Simple Object Access Protocol is actually simple. I guess if you compare to raw sockets yeah. Easier than COM+ ? Hardly. -- Thomas G. Willis http://paperbackmusic.net -- http://mail.python.org/mailman/listinfo/python-list
Re: low-end persistence strategies?
Sounds like you want pickle or cpickle. On Tue, 15 Feb 2005 19:00:31 -0800 (PST), Paul Rubin http://phr.cx@nospam.invalid wrote: I've started a few threads before on object persistence in medium to high end server apps. This one is about low end apps, for example, a simple cgi on a personal web site that might get a dozen hits a day. The idea is you just want to keep a few pieces of data around that the cgi can update. Immediately, typical strategies like using a MySQL database become too big a pain. Any kind of compiled and installed 3rd party module (e.g. Metakit) is also too big a pain. But there still has to be some kind of concurrency strategy, even if it's something like crude file locking, or else two people running the cgi simultaneously can wipe out the data store. But you don't want crashing the app to leave a lock around if you can help it. Anyway, something like dbm or shelve coupled with flock-style file locking and a version of dbmopen that automatically retries after 1 second if the file is locked would do the job nicely, plus there could be a cleanup mechanism for detecting stale locks. Is there a standard approach to something like that, or should I just code it the obvious way? Thanks. -- http://mail.python.org/mailman/listinfo/python-list -- Thomas G. Willis http://paperbackmusic.net -- http://mail.python.org/mailman/listinfo/python-list
Re: Python UPS / FedEx Shipping Module
Good to know. i've always thought that python would make an excellent solution for transportation and logistics software. I used to maintain a nasty vb6 solution, and a lot of the brick walls could have been overcome by utilizing the dynamic nature of python. But, there is not enough hours in the day. And writing a solution puts you in an odd relationship with your partners(UPS/FexEx etc...). On one hand you are helping them indirectly sell their services, On the other, you are sort of competing with them, so, those companies have plenty of reason to screw with you by changing the specs, lot's of hoops to jump through to contiuously be certified. I guess I care anyway because the problem domain is so interesting to me. Maybe it's because I'm running a fever. :) Thanks for the info. On Mon, 14 Feb 2005 09:51:35 -0500, Gabriel Cooper [EMAIL PROTECTED] wrote: Tom Willis wrote: Are the modules just accessing the published apis for their webservices? I'm just wondering because I used to work for a logistics mgmt company that paid money to be a strategic partner with FedEx/UPS/Airborn etc so that they could information on how to return rates/print labels/generate edi's/calculate arrival times etc. I'd get a good laugh out of it suddenly being freely available now. Yes, they use the free API's that have always been freely available. They're just *Impossible* to find on either of UPS's OR FedEx's websites. It took me no less than an hour and likely more just to find the documentation pages on each site. As for putting them up on the web, I should be able to get them up by the end of the week. Gabriel. -- Thomas G. Willis http://paperbackmusic.net -- http://mail.python.org/mailman/listinfo/python-list
Re: wxPython OGL future
What are you looking to do exactly? I don't know what OGL is. On Mon, 14 Feb 2005 16:50:51 -0800 (PST), PD [EMAIL PROTECTED] wrote: Hi Everyone, I am sort of a new developer to python and working in an academic environment. I climbed the learning curve on wxPython far enough to get the functionality I want out of it so far... Now Im in need of a diagramming library (something visio-like) to use for my software and the only option I have seen is OGL. Yet I read that OGL is dead, no longer maintained, obsucure and lacking documentation. Instead of taking a leap of faith and walking off a cliff, Ide appreciate if some people out there who have come across a similar problem have any solutions or suggestions for me... I am so disappointed at the moment I think Im about ready to throw in the towel and crawl back to java. I love python, but it has some real difficulties when it comes to making library choices on what _to_ and _not to_ get yourself into. I appreciate your guidance, Pouya -- http://mail.python.org/mailman/listinfo/python-list -- Thomas G. Willis http://paperbackmusic.net -- http://mail.python.org/mailman/listinfo/python-list
Re: Python UPS / FedEx Shipping Module
Are the modules just accessing the published apis for their webservices? I'm just wondering because I used to work for a logistics mgmt company that paid money to be a strategic partner with FedEx/UPS/Airborn etc so that they could information on how to return rates/print labels/generate edi's/calculate arrival times etc. I'd get a good laugh out of it suddenly being freely available now. On Fri, 11 Feb 2005 19:00:25 -0800 (PST), Kartic [EMAIL PROTECTED] wrote: Gabriel Cooper said the following on 2/11/2005 2:23 PM: I've made UPS and FedEx shipping rate request modules in python using XML. Is there an interest in putting this on the web? I am interested in it for educational value, if not anything else. Please post the web address from which to download. Thanks! -Kartic -- http://mail.python.org/mailman/listinfo/python-list -- Thomas G. Willis http://paperbackmusic.net -- http://mail.python.org/mailman/listinfo/python-list
Re: Unit Testing in Python
I've had great experience doing Test Driven Development. Ideally you would do it from the start, but it is great for refactoring as well. In any language. One of the pitfalls to look out for is to not get too hung up on it. In the end it's just a tool you use at your discretion. When I first started doing it, I would get hung up on how the test framework should look etc... almost as if I was architecting a system. It really slowed me down. I now take this approach... 1. what is the smallest piece of functionality that I want? (What to test) 2. what test will confirm I have this functionality?(How to test it) 3. how will I access this functionality.(Define the API) 4. write test 5. write code 6. run test. 7. repeat 4,5,6 until you're happy. Frameworks like xUnit etc... just enhance the experience but are in no way required in my opinion. Another nice side effect is that your architecture design then comes naturally and it is exactly what you need nothing more, nothing less. I recently converted a very problematic data migration routine that was written in Transact SQL by a consultant who liked to push the limits of their chosen tool. I wrote it in Python because I was predicting that no one could nail down all the possible permutations of data that might come through. I needed the ability for the routine to be flexible. Anywho, using python and TDD I was able to get functionality running/tested from minute 1 using only XEmacs and ipython. On Fri, 11 Feb 2005 12:39:07 +0100, BJörn Lindqvist [EMAIL PROTECTED] wrote: put it) PyUnit project. I'm sorry if this is a obvious question or one that has already been answered, but unit-testing sounds interesting and I'm not sure where to start. Hi Ryan. I belive this (http://www.xp123.com/xplor/xp0201/index.shtml) is a good way to learn about unit testing by practice if you already know the basics of it. It is written in Java but is easy to translate to Python. Unittesting really is great in Python, I try to use it for anything but simple and dirty hacks. -- mvh Björn -- http://mail.python.org/mailman/listinfo/python-list -- Thomas G. Willis http://paperbackmusic.net -- http://mail.python.org/mailman/listinfo/python-list
Re: Unit Testing in Python
Neat the original poster shows up as a potential Phisher with a nice big red warning in gmail. Due to some funky header fakedness. Don't give them your SSN. :) I have a related question. What is PyDoc? I see it come up alot in searches for Unit testing and python, but I've never gotten around to finding out why. Maybe I'll do that now. On Thu, 10 Feb 2005 21:34:06 -0500, Roy Smith [EMAIL PROTECTED] wrote: In article [EMAIL PROTECTED], rhat [EMAIL PROTECTED] wrote: Hi Everyone, I've recently been reading some articles about unit-testing in Python [1] [2], but I am a bit confused: where do I go to get started with this? I tried googling for unittest but all I've found are some old links to projects that already use it, and the older (as the articles put it) PyUnit project. I'm sorry if this is a obvious question or one that has already been answered, but unit-testing sounds interesting and I'm not sure where to start. Thanks, Ryan Kaulakis PyUnit is indeed what I use. It's included in current distributions as the unittest module. The module docs aren't perfect (especially when it comes to the big picture), but there's a good tutorial at http://diveintopython.org/unit_testing/index.html Once you get your head around how it works, it's really quite simple to use. It also has the advantage of being one of a series of X-unit packages for different languages (Junit, C++Unit, etc) which all have the same organization (with allowances made for language-specific requirements). This means once you've learned one, you've got a big head start one learning another one. -- http://mail.python.org/mailman/listinfo/python-list -- Thomas G. Willis http://paperbackmusic.net -- http://mail.python.org/mailman/listinfo/python-list
Re: Unit Testing in Python
It could be a bug in gmail. I wasn't actually accusing you, just thought it was funny enough to point out. Of course you could be more sarcastic than me who knows. :) I'm not worried though. I believe the best strategy against Identity theft is bad credit. So question , do you see the big red block on your own posts, or have I been sitting in front of the puter too long? On Thu, 10 Feb 2005 19:25:13 -0800 (PST), rhat [EMAIL PROTECTED] wrote: Yeah, you know I only ask questions about Test-driven development basics in hopes of obtaining your personal information, so that I can sell it on the Molodovian blackmarket. I'm not a Phisher, I'm a comp-sci major who's too lazy to dig around for his own answers. ;) Thanks for your help Roy, I wasn't sure what the difference between unittest and pyunit were. --|2 \| /-\ |\| |/-\|_||_/-\|15 (the uber-l33t version of my supersecret phishing alias which just so happens to be my actual name) PS: Yeah, I too am plerplexed as to why gmail allowed me to register fakeadmin as a login. Sure makes a good conversation started though. =P -- http://mail.python.org/mailman/listinfo/python-list -- Thomas G. Willis http://paperbackmusic.net -- http://mail.python.org/mailman/listinfo/python-list
Re: Python and version control
I'll throw in my reccomendation for svn as well. It just works. On Wed, 09 Feb 2005 14:01:33 -0800 (PST), Timo Virkkala [EMAIL PROTECTED] wrote: Carl wrote: What is the ultimate version control tool for Python if you are working in a Windows environment? I would very much recommend Subversion. It's in no way specific to either Windows or Python, but it's a wonderful tool. If you've ever used CVS, you'll feel right at home. Or after 10 minutes of learning the commands, that is. And as someone already suggested, TortoiseSVN is a great front-end for SVN. It integrates with the Windows shell very nicely. http://subversion.tigris.org/ http://tortoisesvn.tigris.org/ -- Timo Virkkala -- http://mail.python.org/mailman/listinfo/python-list -- Thomas G. Willis http://paperbackmusic.net -- http://mail.python.org/mailman/listinfo/python-list
Re: win32com/makepy question
Wow Thanks I didn't even know about the gencache that's is exactly what I was hoping for. On Fri, 28 Jan 2005 09:06:15 -, Tim Golden [EMAIL PROTECTED] wrote: [Tom Willis] | It seems in COM late binding is something that should be | avoided if possible. | | Because python seems to be really good at doing thing dynamically I'm | wondering why no one has figured out how to make the functionality in | makepy fire automagically when you need it. I (nearly) always use win32com.client.gencache.EnsureDispatch. There are a few occasions when it refuses to play, and then I'm back to Dispatch. code import win32com.client word = win32com.client.gencache.EnsureDispatch (Word.Application) # # does the same as Dispatch (Word.Application) but does # the makepy stuff first if it needs to. # /code TJG This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk -- http://mail.python.org/mailman/listinfo/python-list -- Thomas G. Willis http://paperbackmusic.net -- http://mail.python.org/mailman/listinfo/python-list
win32com/makepy question
Just a general question. It seems in COM late binding is something that should be avoided if possible. Because python seems to be really good at doing thing dynamically I'm wondering why no one has figured out how to make the functionality in makepy fire automagically when you need it. For example, it would be nice if you are creating an object repeatedly(ADODB.Recordset) that some logic would trigger whatever makepy does to generate and cache the modules generated from the typelib that's accessed. It would be cool, that's all I'm saying. I'm sure the standard response is Why don't you write it and maybe I will, I'm just wondering if anyone has thought of it before and is working on it or whatever. -- Thomas G. Willis http://paperbackmusic.net -- http://mail.python.org/mailman/listinfo/python-list