Py2.5.1 on Ubuntu AMD X2, unicode problems
I'm building 2.5.1 from source, using the ubuntu(7.0.4)-provided gcc 4.1.2. Based on google searches and nints found, here is the process: #---edit configure; test of wchar_t--- #include ncursesw.h #include wchar.h #- cd Lib/test rm test_multibyte* cd ../.. #---edit Include/unicodeobject.h--- /* FIXME: MvL's new implementation assumes that Py_UNICODE_SIZE is properly set, but the default rules below doesn't set it. I'll sort this out some other day -- [EMAIL PROTECTED] */ #define Py_UNICODE_SIZE 4 #ifndef Py_UNICODE_SIZE # LDFLAGS='-L/usr/lib -lncursesw -L/usr/local/ssl/lib -lssl -lcrypto ' \ ./configure --prefix=/usr/local \ --with-gcc=/usr/bin/gcc \ --enable-shared \ --enable-unicode=usc4 \ #---edit Modules/Setup--- (all the std ones) SSL=/usr/local/ssl _ssl _ssl.c \ -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \ -L$(SSL)/lib -lssl -lcrypto #---end edits--- gmake altinstall I'm getting a failure during final libpython binding, on undefined PyUnicodeUCS4_AsWideChar. All the other PyUnicodeUCS4... functions are being found. It specifically says it is checking on the libpython in /usr/local/lib (not somewhere in the source code build dirtree), so that is a possible oddity. Checking with nm on the lib shows AsWideChar is in fact undefined. 1. If I onfigure with unicode=ucs2, does all this go away and I get a working system (efficient or not) on my 64-bit machine? 2. Can you point to a configure (and maybe patch) process which leads to a clean make altinstall. -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Database Apps
Tom Brown [EMAIL PROTECTED] writes: On Monday 10 September 2007 19:52, [EMAIL PROTECTED] wrote: Kindof a poll, kindof curiosity... What is your favorite python - database combination? I'm looking to make an app that has a local DB and a server side DB. I'm looking at python and sqlite local side and sql server side. Any suggestions I have had a lot of good luck with PostgreSQL. It is easy to install and use. It is also very stable. It maybe overkill for a client side database. The psycopg package makes interfacing to PostgreSQL very easy and there is a package for Linux and Windows to make cross-platform development a breeze. -Tom I use postgresql as well. I wonder if Pythonistas do so out of concern for rigor, clarity, and scalability. It works fine for a quick one-off effort and still works fine after scaling to a DBMS server supporting lots of clients, and running 10's of GBs of data. If an app comes already designed for mysql, oracle, sqlite, db2, dbm, etc I'll use those. But for my own projects, it is postgresql, with maybe SQLAlchemy (I'm back and forth on that. Mostly stay with straight SQL). Of course, as long as you write DBI2 compliant code, your app doesn't much care which DBMS you use. The postgresql payoff is in admin functionality and scaling and full ACID. -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list
Re: SSL Issue
Jurian Botha [EMAIL PROTECTED] writes: Sorry if this is a real dumb question, but I'm totally stumped. I'm trying to connect to a https url in order to do some xml-rpc method calls, but I'm getting the following error: Error Type: sslerror Error Value: (6, 'TLS/SSL connection has been closed') What could be causing this error, any clues would be greatly appreciated. Thanks -- View this message in context: http://www.nabble.com/SSL-Issue-tf4388062.html#a12510772 Sent from the Python - python-list mailing list archive at Nabble.com. I don't have a complete story, but here are some hints: 1. The message is from: http://www.openssl.org/docs/ssl/SSL_get_error.html (see ZERO RETURN) probably as filtered by PyOpenSSL, which has its own issues: http://mail.python.org/pipermail/python-dev/2007-August/074322.html 2. Chances are that your certificates are out of whack, or you are misusing the SSL context parameters, or are not telling the HTTP Connection object about the SSL Connection properly. 3. Debugging at the python layer is easier (put print statements in M2Crypto's SSL/Context and SSL/Connection) but if necessary, dive into openssl: http://www.mail-archive.com/[EMAIL PROTECTED]/msg49287.html 4. You can check for the hello handshake using WireShark. 5. I haven't found a tutorial for full Python client/server over HTTPS with verification of both client and server certificates. If that is where you are going, let me know what works. -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list
Re: Sip4.7
luca72 [EMAIL PROTECTED] writes: Hello i have python2.5 with sip4.6 installed on a linux machine, i need to install sip4.7 but i get a lot of error like this: sip.h:525: error: expected specifier-qualifier-list before 'PyMethodDef' sip.h:609: error: expected specifier-qualifier-list before 'sipForceConvertToFunc' sip.h:666: error: expected specifier-qualifier-list before 'PyObject' sip.h:902: error: expected specifier-qualifier-list before 'PyTypeObject sipint.h:81: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token sipint.h:86: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token sipint.h:87: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token siplib.c:39: error: expected ')' before '*' token siplib.c:41: error: expected ')' before '*' token siplib.c:43: error: expected ')' before '*' token siplib.c:45: error: expected ')' before '*' token siplib.c:48: error: expected ')' before '*' token plib.c:285: error: expected specifier-qualifier-list before 'PyObject' siplib.c:290: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'sipWrapperType_Type' Have you some idea why? Regards Luca On Linux, py2.5 installed, sip 4.6 installed: I just tried it using gcc/g++ 3.4.6 and and then a fresh start with gcc/g++ 4.2.0. Both worked fine. If you have an older gcc/g++ that might give the effect. Notice that I have a wrapper to set paths for qt4, and a wrapper to run python2.5.1. These are for convenience and should not impact results, unless of course you aren't makeing qt4 visible to the sip compile process. [sip-4.7]$ qt4 py25 configure.py This is SIP 4.7 for Python 2.5.1 on linux2. The SIP code generator will be installed in /usr/local/bin. The SIP module will be installed in /usr/local/lib/python2.5/site-packages. The SIP header file will be installed in /usr/local/include/python2.5. The default directory to install .sip files in is /usr/local/share/sip. The platform/compiler configuration is linux-g++. Creating sipconfig.py... Creating top level Makefile... Creating sip code generator Makefile... Creating sip module Makefile... [EMAIL PROTECTED] sip-4.7]$ gmake gmake[1]: Entering directory `/usr2/src/qt/sip-4.7/sipgen' gcc -c -pipe -O2 -w -I. -o main.o main.c gcc -c -pipe -O2 -w -I. -o transform.o transform.c gcc -c -pipe -O2 -w -I. -o gencode.o gencode.c gcc -c -pipe -O2 -w -I. -o export.o export.c gcc -c -pipe -O2 -w -I. -o heap.o heap.c gcc -c -pipe -O2 -w -I. -o parser.o parser.c gcc -c -pipe -O2 -w -I. -o lexer.o lexer.c g++ -o sip main.o transform.o gencode.o export.o heap.o parser.o lexer.o gmake[1]: Leaving directory `/usr2/src/qt/sip-4.7/sipgen' gmake[1]: Entering directory `/usr2/src/qt/sip-4.7/siplib' gcc -c -pipe -fPIC -O2 -w -I. -I/usr/local/include/python2.5 -o siplib.o siplib.c gcc -c -pipe -fPIC -O2 -w -I. -I/usr/local/include/python2.5 -o qtlib.o qtlib.c gcc -c -pipe -fPIC -O2 -w -I. -I/usr/local/include/python2.5 -o threads.o threads.c gcc -c -pipe -fPIC -O2 -w -I. -I/usr/local/include/python2.5 -o objmap.o objmap.c g++ -c -pipe -fPIC -O2 -w -I. -I/usr/local/include/python2.5 -o bool.o bool.cpp g++ -shared -Wl,--version-script=sip.exp -o sip.so siplib.o qtlib.o threads.o objmap.o bool.o gmake[1]: Leaving directory `/usr2/src/qt/sip-4.7/siplib' -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list
Re: Issue with CSV
Rohan [EMAIL PROTECTED] writes: Hello, I'm working on a script which collects some data and puts into a csv file which could be exported to excel. so far so good, I'm able to do what I described. When I run the script for the second time after a certain period of time the results should appear next to the results of the last run, I'm unable to make a new column when the script is run after the first time. Ideally I would like to have an output which looks like this. 1/20 1/27 we.pywe.py gh.pygj.py - Indicating tht the file has changed fg.pyfg.py Please help me out. Thanks We'd need to see code to tell what you are doing wrong. The solution is pretty obvious: 1. Model the needed structure, which is a 2D matrix of script x date. Assuming the above output is the nromal case, this can be done with a list of rows, each of which has a list of entries by date. 2. Write reader code which reads a csv and loads it into this structure. 3. Write writer code which writes this structure out to csv. 4. Write orchestration code to a) read the old csv, b) check the loaded structure's data against the new data-on-disk to find changed files, c) update the structure appropriately, d) write out the resulting new csv. -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list
Re: VB frontend to Python COM backend
nik [EMAIL PROTECTED] writes: I have a VB6 application that I would like to attach to a python communications application. I have come across several discussions on using VB with a Python COM back-end, but no starting point. I haven't had anymore luck with google at finding out what this method is called and where to find more information or examples on it. I would really appreciate it if someone could point me in the right direction for using python objects from VB. Thank you, Nik Search for python win32 book. You want Python Programming on Win32 By Mark J.. Hammond, Andy Robinson. It covers exactly this case. -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list
Re: eggs considered harmful
[EMAIL PROTECTED] (John J. Lee) writes: Harry George [EMAIL PROTECTED] writes: [EMAIL PROTECTED] (John J. Lee) writes: [...] 2. You can run your own private egg repository. IIRC, it's as simple as a directory of eggs and a plain old web server with directory listings turned on. You then run easy_install -f URL package_name instead of easy_install package_name . The distutils-sig archives will have more on this. Again, not speaking for anyone else: With 500 OSS packages, all of which play by the same tarball rules, we don't have resources to handle eggs differently. You said earlier: The rules are that a) a very few authorized downloaders obtain tarballs and put them in a depot and b) other users get tarballs from the depot and build from source. Not sure how this differs significantly from running a repository, in the sense I use it above. John Significant differences: depot: Place(s) where tarballs can be stored, and can then be reached via http. private egg repository: Tuned to the needs of Python eggs. E.g., not scattered over several directories or several versions. Thus a depot of self-contained packages can handle: 1. Multiple releases of the depot live at the same time. 2. Packages factored into CD-sized directories (not all in one -f location) 3. Multiple versions of Python, without having a new egg for each. 4. Multiple target platforms. Various *NIX and MS Win and Mac systems -- each at their own OS versions and own compiler versions. All without having platform-specific and compiler-specific eggs. 5. Different package version selections based on compatibility with other (non-Python) packages. E.g., to tune for GIS systems vs 3D animation systems vs numerical analysis systems vs web server systems. 6. Refresh process which does not need to fiddle with egg-ness, or even know about Python. Everything is a tarball. -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list
Re: Setuptools, build and install dependencies
Robert Kern [EMAIL PROTECTED] writes: Harry George wrote: We need to know the dependencies, install them in dependency order, and expect the next package to find them. configure does this for hundreds of packages. cmake, scons, and others also tackle this problem. Python's old setup.py seems to be able to do it. No, generic setup.py scripts don't do anything of that kind. Ok, setup.py itself may not do the work, but from the end users' perspective it works that way. Setup.py runs a configure and a make, which in turn find the right already-installed libraries. The point is, setup.py plays well in such an environment. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list
Re: eggs considered harmful
[EMAIL PROTECTED] (John J. Lee) writes: Harry George [EMAIL PROTECTED] writes: [...] These are unacceptable behaviors. I am therefore dropping ZODB3, and am considering dropping TurboGears and ZSI. If the egg paradigm spreads, yet more packages will be dropped (or will never get a chance to compete for addition). I've asked before, and I'll ask again: If you are doing a Python project, please make a self-sufficient tarball available as well. You can have dependencies, as long as they are documented and can be obtained by separate manual download. 1. Given the presumptuous tone of your own message, I guess I'm not in danger of coming across as more rude than you when I point out that your requirements are just that: your own. The rest of the world won't *always* bend over backwards to support just exactly what you'd most prefer. You deleted the ...at least here, which was intended to make clear I was NOT speaking for the world at large, though possibly for a large chunk of corporate life. Also, this wasn't out of the lbue. I ha ve previously discussed this with several development teasm privately, but the trend appears to be accelerating 2. You can run your own private egg repository. IIRC, it's as simple as a directory of eggs and a plain old web server with directory listings turned on. You then run easy_install -f URL package_name instead of easy_install package_name . The distutils-sig archives will have more on this. Again, not speaking for anyone else: With 500 OSS packages, all of which play by the same tarball rules, we don't have resources to handle eggs differently. 3. Alternatively, you could create bundled packages that include dependencies (perhaps zc.buildout can do that for you, even? not sure) No resources for special handling. John -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list
Re: eggs considered harmful
Robert Kern [EMAIL PROTECTED] writes: Harry George wrote: ...at least around here. I run a corporate Open Source Software Toolkit, which makes hundreds of libraries and apps available to thousands of technical employees. The rules are that a) a very few authorized downloaders obtain tarballs and put them in a depot and b) other users get tarballs from the depot and build from source. Historically, python packages played well in this context. Install was a simple download, untar, setup.py build/install. Eggs and with other setuptools-inspired install processes break this paradigm. The tarballs are incomplete in the first place. The builds sometimes wander off to the internet looking for more downloads. The installs sometimes wander off to the internet looking for compatibility conditions. (Or rather they try to do so and fail because I don't let themn through the firewall.) Have you considered establishing a policy that these setuptools-using packages should be installed using the --single-version-externally-managed option to the install command? This does not check for dependencies. I didn't know that one. I'll try it. Thanks. Alternately, you can provide a company repository of the tarballs and their depedencies tarballs. Your users can use the easy_install option --find-links to point to that URL such that they do not have to go outside of the firewall to install everything. This is a possibility. The tarballs can be seen in a directory listing. They are in different subdirs (for different bundles of functionality), so I'll need -f to look several places. These are unacceptable behaviors. I am therefore dropping ZODB3, and am considering dropping TurboGears and ZSI. If the egg paradigm spreads, yet more packages will be dropped (or will never get a chance to compete for addition). I'm sorry to hear that. Me too. We worked long and hard to get Python established as a standard language for corporate systems development, we have a host of projects that need ZSI, and I look forward to making further inroads into C++, Java, and VB development camps. Didn't really need a roadblock at this point. I've asked before, and I'll ask again: If you are doing a Python project, please make a self-sufficient tarball available as well. You can have dependencies, as long as they are documented and can be obtained by separate manual download. Given the options I outlined above, you can easily satisfy these requirements for the vast majority of setuptools-using packages that are out there. There are a handful of packages that only distribute the eggs and not the source tarballs, but those are rare. I agree pure eggs are rare. The fact that they increased this past quarter was what concerned me. ZODB even looks like a normal tarball, builds ok, but uses a easy-install-style lookup during install. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list
Re: Setuptools, build and install dependencies (was: eggs considered harmful)
Ben Finney [EMAIL PROTECTED] writes: Harry George [EMAIL PROTECTED] writes: Historically, python packages played well in this context. Install was a simple download, untar, setup.py build/install. Eggs and with other setuptools-inspired install processes break this paradigm. The tarballs are incomplete in the first place. The builds sometimes wander off to the internet looking for more downloads. The installs sometimes wander off to the internet looking for compatibility conditions. (Or rather they try to do so and fail because I don't let themn through the firewall.) If you provide the build and install script with all the dependencies already present (in the current directory), my experience is that setuptools does not do any network actions. -- \ Self-respect: The secure feeling that no one, as yet, is | `\ suspicious. -- Henry L. Mencken | _o__) | Ben Finney Thanks for the idea. It doesn't work so well in our context, since many dependencies are installed long before a particular egg is attempted. We need to know the dependencies, install them in dependency order, and expect the next package to find them. configure does this for hundreds of packages. cmake, scons, and others also tackle this problem. Python's old setup.py seems to be able to do it. However, as I understand it, setuptools can't detect previously installed python packages if they were not installed via eggs. Thus, my ZSI install was failing on PyXML=8.3, even though PyXML 8.4 is installed. I can't afford to drag copies of all the dependent source tarballs into an egg's currdir just so it can find them. (We have 6 GB of tarballs -- who knows how much untarred source that would be.) I just found hints that you should not attempt to install ZSI form tarball, but should rather install from an egg. So I was able to install ZSI for py2.4. Unfortunately, that means I would have to carry python-version-dependent renditions of every egg. We have people running on py23, py24, and py25, thus tripling the number of tarballs/eggs to manage. This is the very reason we went to a *source* based repository. -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list
eggs considered harmful
...at least around here. I run a corporate Open Source Software Toolkit, which makes hundreds of libraries and apps available to thousands of technical employees. The rules are that a) a very few authorized downloaders obtain tarballs and put them in a depot and b) other users get tarballs from the depot and build from source. Historically, python packages played well in this context. Install was a simple download, untar, setup.py build/install. Eggs and with other setuptools-inspired install processes break this paradigm. The tarballs are incomplete in the first place. The builds sometimes wander off to the internet looking for more downloads. The installs sometimes wander off to the internet looking for compatibility conditions. (Or rather they try to do so and fail because I don't let themn through the firewall.) These are unacceptable behaviors. I am therefore dropping ZODB3, and am considering dropping TurboGears and ZSI. If the egg paradigm spreads, yet more packages will be dropped (or will never get a chance to compete for addition). I've asked before, and I'll ask again: If you are doing a Python project, please make a self-sufficient tarball available as well. You can have dependencies, as long as they are documented and can be obtained by separate manual download. Thanks for listening. -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list
Re: The Modernization of Emacs
Galen Boyer [EMAIL PROTECTED] writes: On Mon, 18 Jun 2007, [EMAIL PROTECTED] wrote: The problem with this line of thinking is that it aims to make Emacs appeal to people -- I think it is rather the other way around. Certain people appeal to Emacs: certain kinds of people like Emacs and the way it is set up, and they change it to suit their needs. Emacs will always be for people who like to be able to constantly fiddle with their environments which continues to increase the efficiency with which they perform their tasks, increasing the # of tasks they can perform and therefore increasing the # of peers it would take to equal the amount of work they alone perform. Most other environments will be for those just trying to perform their tasks and staying even with the average proficiency chart. -- Galen Boyer constantly fiddle I've used emacs since the 1980's. I've used it for text, xml, html markups, programming in many languages, and natural languages. In a few cases I've fiddled with the environment. I've even written a mode. But it has never been constantly. One does the setup, and then uses it day after day, year after year... until you have a new need, in which case you re-tune your settings and then go back to work. trying to perform their tasks...average proficiency Aye, there's the rub. As Fred Brooks and others repeatedly point out, there is little room in programming for average proficiency. I don't mind folks using any editor they want, as long as they are proficient. In those cases, I have no problem doing Extreme Programming with them -- code a bit, save, the other guy codes a bit. But when someone uses vi and then forgets how to do block moves, or uses eclipse and bogs down the session, or uses MS Notepad and can't enforce language-specific indents, I get frustrated. -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list
Re: Python ODBC
[EMAIL PROTECTED] writes: On Apr 29, 11:34 am, Harlin Seritt [EMAIL PROTECTED] wrote: Is there a Python odbc module that will work on Linux? I have a jdbc connection to a DB2 server. I am looking hopefully for an open source solution and not a commercial one. Thanks, Harlin I would think the odbc module would work. We've used SQLRelay here at work too. Here's a link on the database modules for Python: http://www.python.org/topics/database/modules.html And here's a few links on db2 with Python: http://www-128.ibm.com/developerworks/db2/library/tutorials/db2linux/db2proj/updated/python_db2_interface.htm http://sourceforge.net/projects/pydb2/ http://www-128.ibm.com/developerworks/edu/i-dw-db2pylnx-i.html Hope that helps. Mike I've looked into it, but never got all the way to a solution. As I understand it: 1. The DBMS needs to support ODBC. DB2 does, so ok. 2. You need a client side framework and driver. Those are provided on MS Win platforms. On *NIX platforms, unixodbc and iodbc are the main players. http://www.unixodbc.org/ http://www.iodbc.org/ 3. For *NIX you need python bindings. This is where mxODBC has operated (e.g., with iodbc). But there is an OSS effort at: https://sourceforge.net/projects/pyodb -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list
Re: Command-line option equiv of PYTHONPATH
Antoon Pardon [EMAIL PROTECTED] writes: On 2007-04-27, James Stroud [EMAIL PROTECTED] wrote: Rajesh wrote: Hi, The '-Ipath' option adds the path to the list of directories that contains modules that can be included in a script. I can use it as #!/ usr/bin/perl -Ipath_to_my_modules thereby not asking the user of the script to set the path_to_my_modules in their environment. Is there any equivalent command-line option to the python binary or a command-line version of PYTHONPATH? Regards Rajesh Why not just modify sys.path within the actual script? Maybe because he has multiple versions of modules he wants to test his script against. -- Antoon Pardon Here are some approaches we've used: 1. Write a small script which sets PYTHONPATH and then calls the app. Make a different script for each setup you need. 2. Use a small script to set a couple of envvars, which in turn are used to find the right config file, which has all the config decisions you want. archtool_path= os.getenv('ARCHTOOL_PATH') archtool_cfg = os.getenv('ARCHTOOL_CFG') sys.path.insert(0,archtool_path) import archtool exec import archtool.%s as cfg % archtool_cfg -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list
Re: Numeric Soup
Erik Johnson [EMAIL PROTECTED] writes: Robert Kern [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] http://www.scipy.org/History_of_SciPy numpy is the current array package and supercedes Numeric and numarray. scipy provides a bunch of computational routines (linear algebra, optimization, statistics, signal processing, etc.) built on top of numpy. Thank you. Also see gsl and its python binding. http://www.gnu.org/software/gsl/ http://sourceforge.net/projects/pygsl -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list
Re: Help in Placing Object in Memory
Clement [EMAIL PROTECTED] writes: I am newbie to Python.. i want to know something.. can i place an object in disk instead of placing in Main Memory...? If possible, can you please explain with some scripts...? can two python script share a common object? For the CPU to use the object, it needs to be in RAM. But it is possible to save the RAM image onto disk, and then bring it back later. The common approach is called pickling, though there are several variants on this: http://docs.python.org/lib/persistence.html -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list
Re: Scripting Visio using Python
Paul Watson [EMAIL PROTECTED] writes: I would like to create some additional shapes in Microsoft Visio using the Python language. It would appear that Visio can use any CLR language. Has anyone done this? Can I use the Python package from python.org, or must I use IronPython? An alternative might be to work (cross-platform) wit the vxd (XML) file format. A good reader/writer for that would be handy. -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list
Re: My python programs need a GUI, wxPython or PyQt4?
Joshua J. Kugler [EMAIL PROTECTED] writes: Daniel wrote: I've downloaded both the wxPython and the PyQt4 package, and by the first impression I must say that the PyQt4 system had a very compelling presentation. From what I can understand from the feedback I've gotten so far is that the wxPython is a better choice when it comes to compability (with linux), and it's free even if I want to create applications and sell them. So, from what I understand I will have to go with PyQt4 since (from my understanding): 1. I will not sell the applications I'm working with since they will only be used by the internal QA at a computer game company. Even that is getting on shaky ground, at least according to Troll Tech. See: http://www.trolltech.com/developer/knowledgebase/190/ So, write it for internal use, and put up for distribution on your personal web site (pending company approval, of course). j -- Joshua Kugler Lead System Admin -- Senior Programmer http://www.eeinternet.com PGP Key: http://pgp.mit.edu/ ID 0xDB26D7CE -- Posted via a free Usenet account from http://www.teranews.com There are several OSS suppliers that use GPL, and then try to define its meaning. They are welcome to comment on their understanding of the GPL, but they do not have the authority to actually define its legal ramifications. Check with your company legal staff. Having said that, I have been troubled by trolltech's approach from the beginning, and therefore stay away from it. PyGTK and wdxPython are solid GUIs, without the legal uncertainty. -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list
Re: Python does not play well with others
John Nagle [EMAIL PROTECTED] writes: The major complaint I have about Python is that the packages which connect it to other software components all seem to have serious problems. As long as you don't need to talk to anything outside the Python world, you're fine. But once you do, things go downhill. MySQLdb has version and platform compatibility problems. So does M2Crypto. The built-in SSL support is weak. Even basic sockets don't quite work right; the socket module encapsulates the timeout mechanism but doesn't get it right. In the Perl, Java, PHP, and C/C++ worlds, the equivalent functions just work. That's because, in those worlds, either the development team for the language or the development team for the subsystem takes responsibility for making them work. Only Python doesn't do that. Python has been around long enough that this should have been fixed by now. John Nagle You experience isn't shared by everyone. Some of us find Python the most functional and portable of the candidates you mention. Perl - excellent modules and bindings for just about everything you can think of, but the whole thing is painful to watch. Once you've done a few code reviews on 10,000 line perl packages where even the authors have no idea what the code is doing, you tend to look elesewhere. Java - a world of its own. They reinvent the wheel instead of linking to existing libraries. In the process you get libraries upon libraries upon libraries. Even if there isn't a performance hit, you (as a human) can get lost. And the language is just too verbose to live with. PHP - are we talking web scripts or serious programs? Are you doing numerical analysis, NLP, computational chemistry, or bit twiddling in PHP? C - the portable assembler. Solid, trusted, tunable performance, bindings for everything. Of course memory bugs can stop your project in its tracks for indeterminant periods. C++ - objects tacked onto C; but that didn't work so invent a whole world of templates and rewrite everything again, but now trickier than C to bind to other languages. Good work can be done in C++, but that is a testimony to the programmers and not to the language. Python - it just works. Same scripts run on every platform. Bindings available to every C/C++/FORTRAN library I've needed so far. Often the bindings are not complete, but oddly enough the binding developers have chosen to do just the functions I need, so who cares. A clean architecture for adding more function bindings if I'm so inclined. -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list
Re: My python programs need a GUI, wxPython or PyQt4?
Chris Mellon [EMAIL PROTECTED] writes: On 1/24/07, Giovanni Bajo [EMAIL PROTECTED] wrote: [snip] That page is legal babble, trying to trick you into buying (or making your boss buy) a commercial license. The Qt Open Source edition *IS* GPL and thus it falls under all the normal GPL clauses and uses, irrespective of what Trolltech may or may not think. For instance, see this FAQ: http://www.gnu.org/licenses/gpl-faq.html#GPLRequireSourcePostedPublic which makes pretty clear that a company/organization is basically the same of an individual. Releasing a software within a company for internal usage is by no means the same of releasing it to the public. Basically, for what the GPL is concerned, it is *not* a release or a distribution at all. I should point out that the FSFs position in this regard is not supported by copyright law and that the fact that Trolltech takes a different position is something that you should consider strongly. If the FSFs position were true, there would be no need for per-seat licensing of commercial software (because internal distribution wouldn't be). US copyright law does not draw a distinction between internal distribution and any other kind, and I'm not aware of any case law that does so either. This distinction is also not codified in the GPL itself anywhere, so it's not a necessary condition of the license - it is an interpretation by the FSF and that is all. [snip] It is all interpretation -- even after some cases have wandered through the courts. Mostly the trolltech statements indicate their intent to sue. That right there tells me I want to go elsewhere. -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list
Re: on PySol's popularity
Fredrik Lundh [EMAIL PROTECTED] writes: Tshepang Lekhonkhobe wrote: On Python docs, on faq/installed.html, it's mentioned that PySol is the most common Python application. not really; that page says that installing PySol is a common way to get a Python installation installed without noticing, not that PySol is in itself the most common Python application. and the entire python.org FAQ is horribly outdated. we're working on a replacement, which is currently hosted here: http://effbot.org/pyfaq/installed-why-is-python-installed-on-my-machine.htm /F A plug for PySol. My wife is totally non-techno. She doesn't get the notions of windows, or minimize/maximize, or clicking on the icon down on the toolbar. But she does get PySol. When I recently upgraded, I had to reinstall Python2.2 in order to use the old PySol binaries (couldn't get the build-from-source to work). Linux and Python got a fan due to PySol. It should be considered a cultural treasure, and if a bit of funding would help keep it rolling into the future, that might be worthwhile. -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list
Re: Pyparsing troubles
[EMAIL PROTECTED] writes: Hello, I have written a small pyparsing parser to recognize dates in the style november 1st. I wrote something to the effect of: expression = task + date and tried to parse Doctor's appointment on november 1st, hoping that task would be Doctor's appointment and date would be on november 1st (the parser does match on november 1st to date). I have set task as Regex(.*?), ZeroOrMore(Word(alphas)), etc, but I can't get it to match, it matches everything to task and ignores date until it gets to the end of the string. Can anyone help? As described, this is a Natural Language Programming (NLP) problem, which means you will have a lot more trouble with understanding what you want to do than in coding it. Also, dates are notoriously tough to parse, because of so many variants, so there are libraries to do just that. If you want to tackle it systematically: 1. Get a corpus of texts which illustrate the ways the users might state the date. E.g., 2006-11-01, 1-Nov-06, November 1, Nov. first, first of November, 10 days prior to Veterans Day, next week, . 2. If you can control the input, much better. Either by a form which forces specific values for day, month, year, hour, minute, or by requiring IETF format (-mm-ddThh:mm:ss). 3. Determine the syntax rules for each example. If possible, abstract these to general rules which work on more than one example. 4. At this point, you should know enough to decide if it is a: a) Regular expression, parseable with a regexp engine b) Context Free Grammar (CFG), parseable with a LL(1) or LALR(1) parser. c) Context Dependent Grammar, parseable with an ad hoc parser with special rules. d) Free text, not parseable in the normal sense, but perhaps understandable with statistical analysis NLP techniques. f) Hodgepodge not amenable to machine analysis. 5. Then we could look at using pyparser. But we'd have to see the pyparser code you tried. -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list
Re: merits of Lisp vs Python
[EMAIL PROTECTED] [EMAIL PROTECTED] writes: Kay Schluehr wrote: is rapidly replacing Perl, and Ruby is simultaneously and even more rapidly replacing Python. Really? Given its small base, the percentage increases in Ruby use (for any reason) can look quite impressive. I've see data suggesting Ruby is replacing Perl and maybe Java. But I've yet to see data which shows people dropping Python and moving to Ruby. Where do I find that data? -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list
Re: free, python XML merger?
mistersulu [EMAIL PROTECTED] writes: All: We're looking for a python module which allows for quick merging of two XML files. Both files follow the same schema. One file contains the default values and structure, and the second file contains overriding data for the same tags. Thanks in advance, sulu Sounds like a general XML problem, to be solved with cElementTree perhaps. Can you provide the schema and small examples of the input files and the desired output file? -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list
Re: I think Python is a OO and lite version of matlab
Fredrik Lundh [EMAIL PROTECTED] writes: Allen wrote: It is not make sense to compare earth and basketball. why not? they're both round, so surely they must have been inspired by each other. the question is if humanity invented balls before we figured out that the earth is round, or if it's the other way around... /F In keeping with the computer science flavor, we can say that no one invented earth or balls to be round. Rouindness is an emergent behavior of a substance which has shape-forming adhesion and shape-changing fluidity, and is subject to radially symmetric shape-impacting processes. Magma and gravity for the earth, leather and air pressure for inflated balls, sand and accretion for beach cannonballs, and snow and hand pressure for snowballs. -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list
Re: merits of Lisp vs Python
Mark Tarver [EMAIL PROTECTED] writes: Paul Rubin wrote: Mark Tarver [EMAIL PROTECTED] writes: How do you compare Python to Lisp? What specific advantages do you think that one has over the other? http://google.com/search?q=python+lispbtnI=I'm+feeling+lucky Thanks; a quick read of your reference to Norvig's analysis http://norvig.com/python-lisp.html seems to show that Python is a cut down (no macros) version of Lisp with a worse performance. The only substantial advantage I can see is that GUI, and Web libraries are standard. This confirms my suspicion that Lisp is losing out to newbies because of its lack of standard support for the things many people want to do. Mark It is not just a newbie thing. Even people who are reasonably fluent in Lisp use Python for many tasks, and some make python the default with Lisp as a special case. It would probably be fair to say that the more you know about a variety of languages, the more you appreciate Python. -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list
Re: Pimping the 'cgi' module
robert [EMAIL PROTECTED] writes: Harry George wrote: When I came from Perl, I too missed perl-isms and specifically CGI.pm, so wrote my own: http://www.seanet.com/~hgg9140/comp/index.html http://www.seanet.com/~hgg9140/comp/pyperlish/doc/manual.html http://www.seanet.com/~hgg9140/comp/cgipm/doc/index.html Others on this newsgroup said I'd be better off just doing it in raw python. After a while, I realized that was true. You do triple-quoted templates with normal python idioms. Throw in some persistence mechanisms to deal with maintaining state across transactions, and you are in business. Since then I've looked at Zope, Plone, TurboGears, Django, and (for standalone apps) Dabo. TurboGears is mostly a set of recommendations on what 3rd party packages to use, with a wee bit of glueware. So far nothing feels as simple as just doing it in python. Thats the fragmented journey, almost any web programmer has to go when coming to python. A clear standard, even a clear intro, for simple tasks, like doing state mng, db, error handling, etc. is not there on an easy path. For a level above cgi, what do you think about cherrypy ? http://docs.cherrypy.org/ Robert I have only done hello, world stuff in cherrypy. We do everything from apache, so the server part of cherrypy wouldn't be needed, and getting to it from a mod_rewrite would just be extra hassle. Mostly we do model-view-controller, were the view may be batch, commandline, desktop gui, GUI, SOAP, etc. If it works with a simple coded-by-hand CGI, that's all we do. -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list
Re: Pimping the 'cgi' module (was: Re: python gaining popularity according to a study)
, and (for standalone apps) Dabo. TurboGears is mostly a set of recommendations on what 3rd party packages to use, with a wee bit of glueware. So far nothing feels as simple as just doing it in python. -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list
Re: Will GPL Java eat into Python marketshare?
Fredrik Lundh [EMAIL PROTECTED] writes: Maurice LING wrote: I admit that it is very very unlikely. I guess it is just a wild dream of mine to run Java bytecodes and Python bytecodes on Python VM. I do have a wild vision that we can import java libraries (as jar files) into CPython. http://sourceforge.net/projects/jpype /F Personally, I've never gotten jpype to work. Is it just me, or is it a troublesome install? -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list
Re: Will GPL Java eat into Python marketshare?
Dennis Lee Bieber [EMAIL PROTECTED] writes: On Wed, 15 Nov 2006 22:41:19 GMT, Maurice LING [EMAIL PROTECTED] declaimed the following in comp.lang.python: I'm hoping for a more optimistic outcome that this may open a possibility for tigher interoperability between java programs and python programs. That is, run java class files or java codes natively on python VM. Is this still a blue sky dream? Most unlikely to happen... I don't really see anyone going to the effort to change the javac back-end to target a totally different runtime engine. -- WulfraedDennis Lee Bieber KD6MOG [EMAIL PROTECTED] [EMAIL PROTECTED] HTTP://wlfraed.home.netcom.com/ (Bestiaria Support Staff: [EMAIL PROTECTED]) HTTP://www.bestiaria.com/ I once wrote a partial JVM in Modula-3 (strictly a researchware effort), so I can imagine it being done technically. But why? The big problem with Java-and-Python is not the VMs underneath. It is the fact that Java has layers upon layers upon layers of idiosyncratic libraries and idioms. When you write bindings to that world (even if the bindings are generated automagically), you have to *think* in those same layers. The Python-oriented developer suddenly has to use a dozen imports in order to do things already done better in Pythonesque libraries. -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list
Re: Will GPL Java eat into Python marketshare?
walterbyrd [EMAIL PROTECTED] writes: Some think it will. Up untill now, Java has never been standard across different versions of Linux and Unix. Some think that is one reason that some developers have avoided Java in favor of Python. Now that Java has been GPL'd that might change. IMO: it won't make much difference. But I don't really know. Short answer: People use Python instead of Java because people (at least intelligent people) tend to avoid pain. Long answer: Changing licenses doesn't magically change Java's architecture. It is still a closed world of reinvent-the-wheel, my-way-or-the-highway. Which is antithetical to Python's promiscuous interface-with-anything approach. -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list
Re: Python development time is faster.
Chris Brat [EMAIL PROTECTED] writes: I've seen a few posts, columns and articles which state that one of the advantages of Python is that code can be developed x times faster than languages such as Insert popular language name here. Does anyone have any comments on that statement from personal experience? How is this comparison measured? Thanks Chris Personal experience takes two forms. 1. Broad experience with languages, such that doing a single project in a new language gives a sense of the relative power and ease-of-use. Everyone I know who is a strong Python supporter took that route. There was an Ahh-Ha experience part way into the first project. This includes folks who could charitably be called curmudgeons, and people who are truely fluent in, say, C++ or Lisp. For these people the main success factor is that it just works. You spend time on new functionality, or experimenting with alternative algorithms, not on debugging. Of course, we work in a regression-test-driven world, so we don't pile up a lot of untested code and then hope for the best. Python facilitates that test-early-test-often approach with its modularity and fast edit-run cycle. 2. Write the same thing in 2 or more languages. Due to machine migrations and project redirections I have done that with perl-and-python, java-and-python, modula3-and-python, lisp-and-python. In all cases, python was the second language, so there is some learning curve to be adjusted for (i.e., I understood the semantics better). However, since I've done some perl-and-perl, and lisp-and-lisp, I can maybe make that adjustment. The result was that python was relatively faster-to-develop. I can't give a specific speedup factor, but I sure can say Python is now my default language. The success factors were: a) Once you get the hang of the language (a weekend?), you can write without reference to the manuals. Or if you do reference, it is a quick lookup. No struggling to figure out how to code something. Or to decypher what a line of code actually does. b) The project doesn't bog down as you add features. The language can accomodate new paradigms, patterns, or major functionality. If you do need to refactor, that is easy too. c) Peer code reviews are easy -- both you and the reviewers can understand the code's intent at a glance. -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list
manual eggs downloads?
eggs are wonderful for no-hassle get-all-the-dependencies. However, they can trigger hands-off downloads from various sites. This is Bad News for corporate environments in which every download is carefully pre-approved. A tarball with a subdirectory of third_party packages is ok. A web page simple listing the third party sites and the recommended downloads is ok. Automatically downloading is not ok. Is there some way in the eggs mechanism to just get a list of the proposed downloads, and let the user take the actions manually? -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list
Re: Python tools for managing static websites?
Walter Dörwald [EMAIL PROTECTED] writes: Chris Pearl wrote: Are there Python tools to help webmasters manage static websites? [...] You might give XIST a try: http://www.livinglogic.de/Python/xist/ Basically XIST is an HTML generator, that can be extended to generate the HTML you need for your site. The website http://www.livinglogic.de/Python/ itself was generated with XIST. You can find the source for the website here: http://www.livinglogic.de/viewcvs/index.cgi/LivingLogic/WWW-Python/site/ Hope that helps! Bye, Walter Dörwald 1. If the static page can be autogenerated (e.g., from a data file or from an analysis), the best bet is to just write the html directly. Typically do as triple quoted text blocks with named variable substitutions, then print them with the substitutions filled. The chunks are dictated by the structure of the problem (e.g., functions for beginning and end of html page, for beginning and end of a form, for repeating rows in a table, etc.) Just structure the app reasonably and put in the chnks where needed. NOTE - When I first moved from Perl to Python, I thought I'd need CGI.pm, so I did cgipm.py: http://www.seanet.com/~hgg9140/comp/index.html http://www.seanet.com/~hgg9140/comp/cgipm/doc/manual.html However, I (and others in this newsgroup) recommend the write-directly approach instead. 2. If there must be human-in-the-loop, then it is good to use a markup language which can be converted to html (or to other backends). Perrl's POD format is one, and I've done that as a Pdx. http://www.seanet.com/~hgg9140/comp/index.html http://www.seanet.com/~hgg9140/comp/pdx/doc/manual.html -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list
Re: What's the best IDE?
John Salerno [EMAIL PROTECTED] writes: Neil Cerutti wrote: On 2006-10-26, John Salerno [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: as I have yet to try Vim - maybe I'll try tomarrow. Warning: Vim isn't something you just try tomorrow :) You can become proficient enough for basic editing in about 20 minutes with the built-in tutorial. Getting it to work seemlessly with Python code will take considerably longer. Yeah, it was all the customizing that I could never figure out. years ago this worked for people I was supporting: set softtabstop=4 shiftwidth=4 expandtab Personally, I'm an emacs guy, so I wouldn't know. -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list
Re: Python to use a non open source bug tracker? - Trac?
Fredrik Lundh [EMAIL PROTECTED] writes: Steve Holden wrote: But sadly people are much happier complaining on c.l.py than exerting themselves to support the community with an open source issue tracker. you're not on the infrastructure list, I hear. python.org could still need a few more roundup volunteers, but it's not like nobody's prepared to con- tribute manhours. don't underestimate the community. /F I'm not on the infrastructure list either. But I wonder why it is Roundup or else non-python COTS? I gave up on Roundup a while ago due to too many crashes. I'm now using Trac: a) Open Source b) Python c) Adequate functionality (for me at least) http://trac.edgewall.org/ I'm not trying to sell Trac, but I would like to know what drove the developers away from it. -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list
Re: Python form Unix to Windows
Simon Forman [EMAIL PROTECTED] writes: [snip] Simplest way: Run the app in windows, see what breaks (probably less than you might think), fix it. I have written large apps that required less than a dozen, or no, changes to move between windows and *nix. YMMV Peace, ~Simon I agree with this-- just try it. When I've helped others move code, I found the biggest problem was when they had hardcoded file paths instead of using os.path mechanisms. -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list
Re: excel in unix?
[EMAIL PROTECTED] [EMAIL PROTECTED] writes: [EMAIL PROTECTED] wrote: hi is it possible to create excel files using python in Unix env? if so, what module should i use? thanks Depending on the complexity of your data you might find the csv module useful. It allows you to write comma separated value (.csv) files that Excel reads just fine. We use the csv module a lot. I've also investigated the old DIF and SLK formats for slightly more functoinality. But the coming standards-based world, if you need more than csv, start writing to to the OpenOffice.org formats, either with your own code or via PyUNO. Then use OOo itself or a MS-sponsored ODF reader to translate to Excel format. This should be a maintainable approach over time (but a lot more complex than just csv). -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Projects Continuous Integration
Dave Potts [EMAIL PROTECTED] writes: Hi, I'm just starting a development project in Python having spent time in the Java world. I was wondering what tool advice you could give me about setting up a continuous integration environment for the python code: get the latest source, run all the tests, package up, produce the docs, tag the code repository. I'm used to things like Maven and CruiseControl in the Java world. Cheers, Dave. First, sorry to hear you have had to use Java. You should recover after a few months in Python. Second, welcome to Python. Third, some of us emacs as our IDE. I presume you often have several packages open at once, each with its own regression tests, own documentation, and own CVS or SVN module. You may also have multiple coding languages going at once (e.g., Python, C, C++, FORTRAN, Lisp, PROLOG). Doing this in emacs: 1. Make a separate instance for each package being edited. In the instance make separate frames for a) code buffers, b) test case buffers, c) doc buffers. In the test frame, make a shell window where you can run go_test, thus running your testsuite for that package. In the doc frame, make a shell window where you can run go_doc. (Must of couse have written those go_ scripts, also done in emacs of course.). If there are too many things happening for one desktop, run each package in a separate desktop (you are working in an OS which has virtual screens, right?). 2. Do CVS checkin/checkout in tool of your choice. Emacs can do it. I prefer tkcvs, with editor set to emacs and diff set to emacs's' ediff. Personal preference. 3. Do documentation in the tool of your choice. Emacs can support pretty much any natural language, and has markups for just about any markup mechanism (SGML, XHTML, etc.). I use my own Pdx, edited in emacs, and thus autogenerate HTML, PDF, LaTeX, etc. Again, personal preference. At a minimum, use some mechanism which allow autogeneration of documentation, auto inclusion of code snippets, and hyperlinking. Since the go_doc is run in an emacs shell, use alt-P-return to rerun the line. Redocumenting is thus a 2 keystroke effort. 4. Do testing using a batch go_test script, running a suite built from unittest. As needed, write debug statements to another buffer in that frame, where you can use full emacs functionallity to search it. Since the go_test is run in an emacs shell, use alt-P-return to rerun the line. Retesting is thus a 2 keystroke effort. 5. Oh, yes, coding. Emacs's python-mode.el works fine. Colorize or not as you see fit. There are ways to set up code-completion, but personally I never do it. You can setup etags but I never do -- emacs search and grep-find do what I need. Personal preference. 6. Use exactly the same setup for language after language, decade after decade, platform after platform. Use your brain cells form something useful, like learning new technologies and new algorithms. -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list
Re: json implementation
jon cashman [EMAIL PROTECTED] writes: Hi everyone, Is there a doc comparing different json implementation (example: python-json, simplejson)? Does anyone have a strong recommendation to make? Any problem/issue for a particular implementation? Thanks. - jon _ Is your PC infected? Get a FREE online computer virus scan from McAfee® Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963 I don't know personally, but TurboGears uses json-py. https://sourceforge.net/projects/json-py/ -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list
Re: Project organisation
rony steelandt [EMAIL PROTECTED] writes: Imagine I have x projects and they all use util.py What would be the best way to organise this 1. c --\project1\*.py | |-\project2\*.py | --\globals\util.py This organisation has the problem that if I have to modify something to util.py that I need in project2, I'll have to retest project1 to make sure it still works (that could be project 1..n). 2. A copy of util.py in each project directory ? The advantage is that I can modify each util.py in function of the need of the project but it looks clutered, having n versions of util.py. What is the best solution ? or is there another even better solution ? Rony Is util.py supposed to do the same thing wherever it is used? No one can answer that for you. Your comments suggested mostly the same, but some differences. In that is the case, then use one main util.py for the common items, and do a local util.py for the locally-specific items. Given proper attention to paths, there should be no confusion. I wouldn't bury the common util.py in a package called globals. That could get really confusing. You might make it a standalone package, or maybe use utilities or common. -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list
Re: [OT] Prolog and Regular Expressions, Was: Re: perspective on ruby
Kenneth McDonald [EMAIL PROTECTED] writes: [snip] That said, it'd be nice if there were some easy way to access a Prolog engine from Python. When Prolog is appropriate, it's _really_ appropriate. Cheers, Ken http://christophe.delord.free.fr/en/pylog/ http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/303057 http://www.ibiblio.org/obp/py4fun/prolog/prolog2.html http://sourceforge.net/projects/pyprolog/ Also, before these showed up, we locally did prolog-calls-python and python-calls-prolog (all from a C++ CAD engine) by using the embedding libraries and bindings. -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list
Re: How to link foreign keys primary keys using python?
sonal [EMAIL PROTECTED] writes: Hi all, I hv started with python just recently... and have been assigned to make an utility which would be used for data validations... ,snip] plz help me... till get my hands on python... :) 1. This sure looks like a school assignment. 2. till get my... Do you actually not have python installed yet? It is hopeless to tackle this problem if you haven't done a few simple hello, world tasks. 3. Do you have a data model? In this case, you need to think carefully about what a RDBMS, PK, and FK are. In otherwords, a metamodel. Generally, once you understand the data structures you should implement them pretty much verbatim in a model module. Then do reader/writer modules so you can load that model from your data sources and dump out to your data sinks. 4. Do you have a testsuite and test harness? Put together your test harness, then develop for the simplest case, then add complexity. E.g., no FK, FK with 1 attr, FK with multiple attrs, FKs with shared attrs. -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list
Re: Open Source Charting Tool
A.M [EMAIL PROTECTED] writes: Hi, I developed a HTML reporting tool that renders Oracle data to HTML and Oracle. At this point I have to add charts (3d bars and pie charts) to this application. I don't think that I have to do it from scratch. Is there any open source charting tool that help me create charts in JPG or gif format? Thanks, Alan See pygdchart http://www.nullcube.com/software/pygdchart.html -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list
Re: How do you practice Python?
Ray [EMAIL PROTECTED] writes: bruno at modulix wrote: In our field, we don't always get to program in the language we'd like to program. So... how do you practice Python in this case? Say you're doing J2EE right now. Hopefully not ! I am :-( How do you practice Python to keep your skills sharp? How *would* I do ? Well, perhaps I'd use Jython ? Um, I mean, what if you have to use something other than Python/Jython/IronPython? :) How do you keep your Python skill sharp? -- bruno desthuilliers python -c print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in '[EMAIL PROTECTED]'.split('@')]) Do projects at home. Either find an existing OSS project, or roll your own. Once you have the basics of the language, the skills are domain-specific: XML, GUIs, CAD, gaming, multithreading, numerical analysis, natural language progromming, etc. If you do an existing project, then you benefit from peer reviews and other informal learning opportunities. -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list
Re: Programming language productivity
malv [EMAIL PROTECTED] writes: [snip] Once you get involved in larger projects, the dynamic nature of the programming tool becomes much more important. I mean by this, the ability to stop running code, modify or add to it and continue without having to re-establish the state of the program. This may sound trivial to many, but in major applications setting up the state again can take a considerable processing time. Such feature should be available from within the debugging tools. In fact, languages like Smalltalk, Lisp and even VB offer this possibility. Ruby coming up strongly these days also has this dynamic reload capability. To sum up, I like Python very much but I don't understand how come this basic flaw has not been taken care of. It is sufficient to search for reload to see how many people have struggled with it over the years. I hate the idea of having to take up Ruby to really find out how it could serve me better in this most critical productivity area. What is major project? We have 50 people working on a project, over 5 years, in Python. Much of the regresison test can be done by rebuilding context in RAM (no need to persist). That is immediate (whole test suite runs in a few seconds). Sometimes we have to reestablish context by clearing the database and then reloading objects from test_input XML files. That is slow (perhaps an over night job). I've yet to experience a context where language features are the rate limiting step. On the other hand, I have definitely experienced language as a rate limiting factor in a) peer code reviews, b) debugging, c) ramping up new team members. Python wins those battles everytime. -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list
Re: Using python for a CAD program
. Nothing wrong with reinventing a few wheels, but I always like to start with a literature search. It wasn't clear if you had done so. At a minimum, take a look at: 1. OSS EE suites: http://www.opencollector.org/ http://www.geda.seul.org/ I don't see rewriting ngspice or Icarus Verilog -- people of people doing that. Putting a good DBMS behind gscheme on the other hand makes sense. Also, I write Python scripts around geda and there has been discussion of embedding Python. 2. Databases: Locally, we have struggled with various DBMSs. It seems OO is mandatory, so I look to Postgresql with inheritance, or (smaller scale) ZODB. I really wouldn't want to grow one from B+ trees. http://www.postgresql.org/ http://www.zope.org/Products/StandaloneZODB 3. 2D CAD and game engines: http://directory.fsf.org/PythonCAD.html http://pygame.seul.org/news.html 4. 3D CAD Locally we write Python code against several commercial CAD packages (I agree with your assessment). For an OSS effort, the only game in town seems to be: http://www.opencascade.org/ http://free-cad.sourceforge.net/ 5. Knowledge Based Engineering (KBE) inference engines: Python already gives you lazy evaluation and memoizing, but a prolog-based backward chaining engine helps too. We wrote CAD-engine-calls-python-and-prolog and python-and-prolog-calls-CAD-engine scripts. http://sourceforge.net/projects/pyprolog/ http://christophe.delord.free.fr/en/pylog/ http://arts.anu.edu.au/linguistics/People/AveryAndrews/Software/AmziPy/Doc/manual.pyfrompro.html http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/303057 6. Simulation http://simpy.sourceforge.net/ Also need FEM for electromagnetic analysis, and CFD for heat dissapation. -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list
Re: Tabs versus Spaces in Source Code
Edward Elliott [EMAIL PROTECTED] writes: Eli Gottlieb wrote: Actually, spaces are better for indenting code. The exact amount of space taken up by one space character will always (or at least tend to be) the same, while every combination of keyboard driver, operating system, text editor, content/file format, and character encoding all change precisely what the tab key does. What you see as tabs' weakness is their strength. They encode '1 level of indentation', not a fixed width. Of course tabs are rendered differently by different editors -- that's the point. If you like indentation to be 2 or 3 or 7 chars wide, you can view your preference without forcing it on the rest of the world. It's a logical rather than a fixed encoding. [snip] This has been discussed repeatedly, and the answer is If you only work alone, never use anyone else's code and no one ever uses your codes, then do as you please. Otherwise use tab-is-4-spaces. When you do Agile Programming with people using emacs, vim, nedit, xedit, wordpad, eclipse, and who knows what else, the 4-spaces rule is necessary for survival. The reason is simple: People get confused, and accidentally get the wrong tab indents when they move among editors or among settings on the same editor. In most languages this is an irritation, requiring some cleanup. In Python it is a disaster requiring re-inventing the coded algorithms. -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list
Re: An Atlas of Graphs with Python
Paddy [EMAIL PROTECTED] writes: A little off topic I'm afraid Giandomenico, But I had to smile. Here is someone working in the field of linguistics, who wants a programming solution, in the language Python. (It's Larry Wall, creator of Perl that cites his linguistic foundations). -- Pad. I used Python for computational linguistics coursework, but not since. Google for nlp python. E.g.: http://nltk.sourceforge.net/ http://www.logilab.org/projects/hmm http://www.cs.berkeley.edu/~russell/aima/python/nlp.html -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list
Re: Looking for resources for making the jump from Java to Python easier and more productive
Lawrence D'Oliveiro [EMAIL PROTECTED] writes: In article [EMAIL PROTECTED], ToddLMorgan [EMAIL PROTECTED] wrote: Are there python specific equivalents to the common Patterns, Anti-Patterns and Refactoring books that are so prevalent as reccomended reading in C++ and Java? I don't think they exist. Such books are targeted more towards development in a corporate environment, where every proposal has to go through multiple layers of management, and nothing is ever done by individuals working alone, always by teams working on separate parts of the project. And also where the end-users don't really get much say in how things are supposed to work. It's only in such a high-overhead, top-down, cover-your-ass environment that such books are looked on as being at all useful. Possibly on the grounds that nobody ever got fired for buying them. I'd say languages like Python and Perl are the absolute antithesis of this sort of development culture. On antithesis comment: Python can be used for Agile Programming, with the end user there at the monitor. But it can also be used for heavy duty development regimens with data models, specifications, development teams working multiple shifts or working worldwide, separate test-and-release teams, etc. On response to the OP: The most important thing you bring to the table is knowledge of data formats, algorithms, OO programming, and test-driven design. E.g., XML, HTML, LDAP, SQL, pipes, stacks, queues, threads, dictionaries, lexers, parsers, regular expressions, matrix transformations, GUI dialogs, etc. Many of us consider Python a secret weapon in learning new paradigms and technologies The most important things you need to leave behind: 1. Intuition about what is already available vs what you have to write. Java tries to reinvent the whole compsci world. Python just says Nice C/C++/FORTRAN library; I think I'll use it via a binding. If it is codable, it is probably scriptable in Python. 2. Temptation to reinvent entire stacks of libraries to replicate the Java module import structure. This is a real problem in migrating existing code. You have to take deep breath and ask What is the fundamental task, and how would a programmer do that in Python? Entire library trees melt away when you do this. 3. Fear you are missing something when you get done. Python takes c. 1/3 as many LOC as Java for the same task. At first I kept saying: This wee bit of code couldn't posssibly do the whole job, could it? If you have a good regression test suite, you are done when it works. If you need help getting on board unittests, see mkpythonproj: http://www.seanet.com/~hgg9140/comp/index.html#L006 -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list
Re: Speed abilities
Coyoteboy [EMAIL PROTECTED] writes: Ive read a few comments, the usual about it being slower,sometimes vastly slower than a C++ written item but I was wondering if its 'slow' incomparison with what I need. I'm looking at taking two arrays of 12 bytes over an ethernet connection, comparing them, recieving correction data (single byte) from another module over a pipe at approximately 900Hz and using all these with a fairly complex set of algorithms to generate a new set of 12 byte data. This has to be done in a very short time, preferably the same rate of throughput as the 900Hz. Am i asking too much of Python? I find C++/MFC fairly complex and python looked like a great alternative if it hadnt been 'flagged' as slow. Cheers J There is no way to tell from this info. This is a real-time problem. If you assume 1GHZ CPU, 10 clks/instruction, 1 instructions/event then you require 0.001 sec/event. 900Hz event rate means you only have 0.0011 sec/event available, which is the same order of magnitude. Chances are, variation in the event rate or in the OS response time would violate this small safety factor, even if the assumptions were dead on. So you need a faster machine or fewer instructions. Some instructions will be used in the OS and interface stack, no matter what language you use. Some will be used in your fairly complex set of algorithms. You may have used up your 1 instructions without getting around to Python. Even assembler might be too slow. If you did implement in Python and found it was too slow by a moderate factor (e.g., you could only handle 500Hz event rate), then you can stay in python to explore alternative implementations. E.g., multiple processors in parallel, more efficient algorithms, ctypes or pyrex to speed up the python. In terms of the overall project notion-to-delivery duration, implementing in Python might be the right first step on your way to an assembler implementation. -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list
Re: DO NOT USE JAVA BECAUSE IT IS NOT OPEN SOURCE
geletine [EMAIL PROTECTED] writes: Nobody has mentioned that c was proprietary until richard stallman wrote gcc in 1987, c is a great for system programming. Just because something is originally proprietary does not mean its technically rubbish, there are plenty of merits in java escially for new programmers or anyone who wants to get a program going very quickly. Gcj at the moment can do most tasks apart from swing gui, i believe Awt is well supported. To further my position, without the proprietary(it was licenced on a liberal account at the time) UNIX created in bell labs, they would possibly not be linux. Miguel de Icaza started implemening mono as he too saw technical advantages in .net, he is freeing the language in my opinion. Technology is just as important as polictics, hopefully i am well understood With or without licensing issues, Java causes technical heartburn to those accustomed to Python. Adding to that the fact that OSS developers are sceptical of Sun's strategies (the message changes as Java's fortunes rise and fall), and you get a significant pushback. I read Mono as a challenge to Microsoft: You claim this is open? Ok, we'll implement it and then see where the submarine patents pop up. Why would I want to let one company's abstract model sit between my code and every piece of hardware I wish to touch? -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list
Re: best way to install python modules on linux
Fabian Braennstroem [EMAIL PROTECTED] writes: Hi, I am pretty new to python and will use it mainly in combination with scientific packages. I am running ubuntu breezy right now and see that some packages are out of date. Do you have any suggestion, how I can get/keep the latest python modules (e.g. scipy, numpy,...) on my ubuntu system? I.e. does there exist any script/program, which downloads and installs automatically the latest stable releases of selected modules? It would be nice, if the program can remove the installed modules, too!? Or would it be easier to stick to apt/deb and create own packages ... Greetings! Fabian I find it helpful to leave the as-delivered Python (e.g., /usr/bin/python) as-is. It is being used to run your basic Linux system. Screwing around with it can have nasty side effects. Instead I build a new one at /usr/local, give it a unique name, and upgrade/hack that one to my heart's content. E.g., if the base system is using Python 2.2, you can be running Python 2.4 as /usr/local/bin/py24, and add all the numerical packages you wish at use/local/lib/python2.4/site-packages. Also, make sure root doesn't have /usr/local/bin on its PATH (which is a good rule anyway). -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list
Re: python debugging question
[EMAIL PROTECTED] writes: I am a python newbie. I have writen some 500 lines of code. There are 4 classes and in all 5 files. Now, I am trying to run the program. I am getting wrong values for the simulation results. Is there any debugging facilities in python which would let me go step by step and check the values of the variables at every step. I have done something like this in MS Visual Stdio 6.0 sometime back. For python, I am using SPE. what is a good way of debugging such large and iterative programs ? Any tips. Every help is appreciated. Thanks If you use my mkpythonproj: http://www.seanet.com/~hgg9140/comp/index.html#L006 then you will have a test suite and a debug ftn ready to go. For a brand new project, where you are exploring and don't know what the test cases might be, you can just do the debug calls. Once you know where you are headed (or if you got rqmts at the start) then crank up some test cases and run that testsuite everytime you add a few lines of code. Start exploring or testing at the hello, world level, and gradually add functionality (tests and code) as you go. This is MUCH easier than writing a lot of code and then trying to debug it. You only need to understand a few lines at a time. In tens of thousands of lines of python code, I think I've used a debugger (pdb) maybe once. We have some apps here that are one-off quick hacks and others that are multi-person, multi-year efforts. They all live by their test suites. -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list
Re: Learning different languages
gene tani [EMAIL PROTECTED] writes: Rich wrote: Hi, (this is a probably a bit OT here, but comp.lang seems rather desolated, so I'm not sure I would get an answer there. And right now I'm in the middle of learning Python anyway so...) Anyway, my question is: what experience you people have with working with different languages at the same time? http://www.infoworld.com/article/06/02/22/75452_09OPstrategic_1.html re the article: To say Java and Python could use the same libraries misses a) dynamic programming in python and b) the re-invent-the-wheel ethos of the whole Java world. Python shares libraries with all other languages when it does bindings to std libraries. Java almost never does this, preferring instead to roll-its-own. In its effort to beat MS at is own lockin game, Java deliberately does not play well with others. (Not that I'm fond of MS and its .NET lockins either.) re the OP: I find I have to concentrate on one language for a while (several programs) to ramp up on the syntax, semantics, idioms, and libraries. Then I'm safe to wander off and learn other languages. When it comes time to do a project, I use one main language unless it really is a bad match, in which case I write in one of the others. My one language has variously been over the years Pascal, Modula-2, Modula-3, perl, and Python. Even though I've written substantially in COBOL, FORTRAN, Lisp, Prolog, and Java, I wouldn't use these for a default language. -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list
Re: Python and Java
JKPeck [EMAIL PROTECTED] writes: Suppose you have an application written in Java, and you want to enable other applications or processes written in Python to communicate with it, i.e., to use Python as a scripting language for the application. On Windows you could do this with COM and various addons such as J-Integra and Mark Hammond's libraries. How would you do this if you want a mechanism that is portable across Windows, Linux, Mac, and Unix? Any ideas? Jython would be a natural candidate, but it is stuck at Python 2.1 and seems to have an uncertain future. Thanks in advance. If you need real CPython (e.g., need add-on libraries compiled in C), then XMLRPC is a clean way to make the connection. -- http://mail.python.org/mailman/listinfo/python-list
Re: Fromatting an xml file
sir_alex [EMAIL PROTECTED] writes: Hi! I have a little problem writing xml files formatted in a way like the following: rootnode nodebla/node nodebla/node /rootnode Every new node element should have a tabulation before it, but when I use xml.dom.minidom I use writexml, which considers as a new node also the text (in my little example, bla phrases), so the best result I achieved has been the following rootnode node bla /node /rootnode but I don't want the text to be written on newlines... is there a good solution? Thanks! Based on recommendations from this newsgroup, I write XML directly, instead of going through DOM. That in turn requires a mechanism for tabbed indents, so I wrote tabbedwriter: http://www.seanet.com/~hgg9140/comp/index.html http://www.seanet.com/~hgg9140/comp/tabbedwriter/doc/tabbedwriter.help -- [EMAIL PROTECTED] 6-6M21 BCA CompArch Design Engineering Phone: (425) 294-4718 -- http://mail.python.org/mailman/listinfo/python-list
Re: GUI toolkit question
[EMAIL PROTECTED] writes: I'm building an app that operates on tuples (typically pairs) of hierarchical structures, and i'd like to add a GUI to display my internal representation of them, and simplify manipulations/operations on them. My requirements are: 1) Draw a single 3D representation of the hierarchies, and the connections between them. 2) All objects must be interactive. That is, they should have left/middle/rightClick behavior; they must be draggable (with rubber band behavior of their conncections); the user should be able to highlight a set of them, associate them as a group, then execute some group operation. 3) I don't need very fancy stuff from the normal widgets. Just menus, a few buttons, dialog boxes, etc. 4) Don't need complex 3D behavior. 5) Don't need to ever run on Windows, just *nix. 6) May eventually need to either compile the Python, or port part/all of it to C++. I started looking into Qt, Wx, Blender, etc, but don't even know if i have the right questions in mind. Any thoughts, considerations, recommendations would be much appreciated. thanks in advance, Eric The GUI toolkits (gtk, qt, wx, fltk, etc) generally give you a 3D window, and then you are on your own. In the window you could use VRML, X3D, or your own homegrown OpenGL treatment. Next up the foodchain, there are visualization tools which can link together lots of nodes and arcs. See: http://www.opendx.org/index2.php -- [EMAIL PROTECTED] 6-6M21 BCA CompArch Design Engineering Phone: (425) 294-4718 -- http://mail.python.org/mailman/listinfo/python-list
Re: SOAPpy/ZSI/Twisted SOAP over stdin/stdout?
Harry George [EMAIL PROTECTED] writes: Normally the SOAP Servers are designed to take control of a port and run their own sockets via inheritance from SocktServer. But under inetd and xinetd, the port is controlled elsewhere and the service just gets the stdin/stdout. I need to configure (or tweak) one of the SOAP servers to use that connection. Has anyone done this with any of the above named SOAP servers? Recommmendations or hints if I try it myself? First, thanks for the hints - I definitely want to investigate Twisted basic. Second, I've solved it by doing an xinetd redirect. Do external control on one port, then pass the data to an internal-only port which is watched by the SOAP server. -- [EMAIL PROTECTED] 6-6M21 BCA CompArch Design Engineering Phone: (425) 294-4718 -- http://mail.python.org/mailman/listinfo/python-list