Re: How to use protocols.msn.FileSend and protocols.msnFileReceive
yamadora1999 wrote: > How to use protocols.msn.FileSend and FileReceive? > Please show me a example. Excellent example here: http://catb.org/~esr/faqs/smart-questions.html -- Soraia: http://www.soraia.com Better than a smack in the teeth -- http://mail.python.org/mailman/listinfo/python-list
Re: a wrapper to invoke functions using argument
[EMAIL PROTECTED] wrote: Hi, support I have a library of function, called mylib.py, in which there are 2 functions 'f1' and 'f2' (1 arguments in either one); Now I want to write a wrapper that will invoke f1 or f2 using the command line argument. So for example, I want to write a function "call.py" and invoke it as python call.py f1 arg1 So this is straight forward, but I don't know how to evaluate a function. any help would be much appreciate it. les There is a FAQ about this: http://www.python.org/doc/faq/programming.html#how-do-i-use-strings-to-call-functions-methods -- Soraia: http://www.soraia.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Moving to Python from PHP - 3 questions
Michal Migurski wrote: Thank you. My impression of Zope in the past has been that it does what I need, along with 10,000 other things I don't (built in WebDAV server?!), but clearly I owe it another chance. I've been initially attracted to mod_python because of its raw simplicity and its apparent similarity to mod_php and mod_perl, which I am familiar with. I'll give Zope a try. I am moving my band's website from an antiquated and horrible PHPNuke site to a Python-based site, and so have done quite a bit of research about this (though I never considered myself a PHP expert). Here's what I've come up with... Zope is excellent (especially with Plone), but if you are not building applications that require lots of levels of access and permissions and collaborations, as well as the 10,000 other things you speak of, you probably would like something simpler than Zope, such as CherryPy or Quixote. Both are excellent and light-weight frameworks that give you session support and easy access to request variables (as well as full access to the entire Python language). Conceptually, the two are very close, but I am slightly more biased towards CherryPy lately. Quixote has better built in form support, but now that I've discovered FormKit, this seems to becoming a non-issue. Also, both are pure Python so should run anywhere Python does (though Quixote has a C extension, it will fallback to a somewhat slower pure-Python version if your platform cannot compile the extension). There are other good frameworks out there, like Nevow and Webware, but have a somewhat larger conceptual overhead which doesn't rest as easy with me. You'll also want to probably look at some of the templating kits, of which Cheetah and/or ElementTree work best for me. (Well, ElementTree isn't exactly a templating kit - it's a general-purpose XML tookit - but it is easily used for templating.) General Python web programming: http://www.python.org/topics/web/ Frameworks/toolkits: [CherryPy] http://www.cherrypy.org/ [Quixote] http://www.mems-exchange.com/software/quixote [FormKit] http://dalchemy.com/opensource/formkit/ [Cheetah] http://www.cheetahtemplate.org/ [ElementTree] http://effbot.org/zone/element-index.htm [Nevow] http://nevow.com/ [Webware] http://www.webwareforpython.org/ For more comparisons of some of the various frameworks: [PyWebOff] http://pyre.third-bit.com/pyweb/index.html [Python Web Shootout (older)] http://www.colorstudy.com/docs/shootout.html -- Soraia: http://www.soraia.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Multiple initialization methods?
On 16 Feb 2005 13:31:31 -0800, alex <[EMAIL PROTECTED]> wrote: Hi, it is possible to define multiple initialization methods so that the method is used that fits? I am thinking of something like this: def __init__(self, par1, par2): self.init(par1, par2); def __init__(self, par1): self.init(par1, None) def init(self, par1, par2): ... ... So if the call is with one parameter only the second class is executed (calling the 'init' method with the second parameter set to 'None' or whatever. But this example does not work. How to get it work? Alex You can do this: def __init__(self, *args, **kwargs): #args is a tuple of positional args #kwargs is a dict of named args print args, kwargs #real code here instead of lame print statements try: self.name = args[0] except IndexError: self.name = '' self.occupation = kwargs.get('occupation', '') or even better, do this: def __init__(self, name='', occuaption='', age=0): #named args with default values self.name = name self.occupation = occupation self.age = age Based on this, you should have enough information to make your class work. -- Soraia: http://www.soraia.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: How can I Fill in web form and post back
On Wed, 16 Feb 2005 19:05:35 GMT, Rigga <[EMAIL PROTECTED]> wrote: Joe Francia wrote: Rigga wrote: Hi, I am looking for the best way to use Python to get a web page, look for some particular fields on a form, fill in the fields and submit the form but I have no idea where to start - any pointers appreciated many thanks Rigga Here's a pretty good resource: http://www.google.com/search?q=python+fill+web+forms Thanks but I already checked there and didnt come up with much Really? The second link is for ClientForm, the description of which reads: "ClientForm is a Python module for handling HTML forms on the client side, useful for parsing HTML forms, filling them in and returning the completed forms to the server." That seems to exactly fulfil your requirements. Are you sure you really looked? -- Soraia: http://www.soraia.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Calling a function from module question.
Sean wrote: Sean wrote: Then I would have a script that uses the print_this function defined in the module without using the module name in the call. from module_name import print_this or, even: from module_name import print_this as other_nice_name So what if I have a whole bunch of functions - say 25 of them. Is there a way to do this without naming each function? You do that like so: "from module import *". But you should avoid that, as stated in the Python help: Note that in general the practice of importing * from a module or package is frowned upon, since it often causes poorly readable code. However, it is okay to use it to save typing in interactive sessions, and certain modules are designed to export only names that follow certain patterns. The "certain patterns" usually occur in huge packages, such as in the various GUI toolkits. E.g., all of the exported PyQt classes are prefaced with Q (QButtonGroup, QTabWidget), so doing "from qt import *" is fairly safe. You can also import a module like so: "import module as m" to save on some typing, if that is your concern. But namespaces are a feature of Python, not a limitation, so the Python way is to use them for clearer code. With a large number of functions like that, it sounds more like you should be inheriting from a class anyway, which I think is what Steven Bethard meant when he suggested refactoring. For more information on the Python way, go to the Python interpreter and type "import this" ;>) -- Soraia: http://www.soraia.com -- http://mail.python.org/mailman/listinfo/python-list
Re: How can I Fill in web form and post back
Rigga wrote: Hi, I am looking for the best way to use Python to get a web page, look for some particular fields on a form, fill in the fields and submit the form but I have no idea where to start - any pointers appreciated many thanks Rigga Here's a pretty good resource: http://www.google.com/search?q=python+fill+web+forms -- Soraia: http://www.soraia.com -- http://mail.python.org/mailman/listinfo/python-list
Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler
Ilias Lazaridis wrote: Joe Francia wrote: Ilias Lazaridis wrote: [...] MinGW compatibility is not [only] my need. It is an community need [at least partially] You keep using that word "community". I do not think it means what you think it means. The community is everyone around python (including me at this moment). We could call i userbase, too, but one needs not to be a actual user to be a community member. Well, I'm glad you cleared that up (even though you clearly missed the "Princess Bride" reference). As a member *and* user in the Python community, I hereby declare MinGW as unnecessary to the successful continuation of Python. When I need to compile extensions on win32, VS.NET works splendidly. (And gcc covers my FreeBSD & Linux extension compiling needs - I have no unusual demands or expectations that the Python "community" will support, say, the Intel C compiler on those platforms). > what do you think about? Oh, different things at different times, but it's usually not about MinGW support for Python. -- Soraia: http://www.soraia.com -- http://mail.python.org/mailman/listinfo/python-list
Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler
Ilias Lazaridis wrote: Mike Meyer wrote: Ilias Lazaridis <[EMAIL PROTECTED]> writes: MinGW compatibility is not my need. Then why do you waste so much effort whining about it not being given to you? It is an community need. Based on the evidence at hand, this is a false statement. MinGW compatibility is not [only] my need. It is an community need [at least partially] You keep using that word "community". I do not think it means what you think it means. -- Soraia: http://www.soraia.com -- http://mail.python.org/mailman/listinfo/python-list
Re: [perl-python] problem: reducing comparison
Xah Lee wrote: here's a interesting real-world algoritm to have fun with. From you? Doubtful. Sorry, dude, but you've been replaced by über-troll Ilias Lazaridis. Security will escort you to the door. -- Soraia: http://www.soraia.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Python and version control
Chris wrote: Hi Joe, I'm curious. Why do you only use Eclipse for big projects? Habit, mainly; plus it's easier for one-offs and single-file scripts to just right-click a file in Explorer and "Edit with ScITE" and work from there. And to further complicate matters, when in FreeBSD or Linux, Eric3 and Kate fill the same roles as Eclipse and SciTE in Windows-land. Peace, Joe -- Soraia - http://www.soraia.com -- http://mail.python.org/mailman/listinfo/python-list
Re: PyQt and Python 2.4 - also WinXP LnF?
Simon John wrote: Also, would I have to build it all myself or does Riverbank/TheKompany provide binaries like PyQt 3.13 for Python 2.4, as I don't have Visual Studio I can't build it myself. There is a GPLed version of Qt that will build on win32, and free compilers to build it with. Despite it coming from the KDE-Cygwin project, it does not require Cygwin to build or run. http://kscraft.sourceforge.net/convert_xhtml.php?doc=pyqt-windows-install.xhtml http://kde-cygwin.sourceforge.net/qt3-win32/compile-msvc-2005.php http://kde-cygwin.sourceforge.net/qt3-win32/compile-mingw.php Peace, Joe -- http://mail.python.org/mailman/listinfo/python-list
Re: Python and version control
Carl wrote: Dear friends, What is the ultimate version control tool for Python if you are working in a Windows environment? When you work on a Visual C++ project then it's easy, use Visual Source Safe for your source code! But when it comes to large Python projects and no universal Python IDE with version control integration is available, checking in and out files is not as simple. I am a keen user of Emacs, but version control, which is very simple when you are in a Linux environment, for example, is not a straightforward in Windows. What is the most common adopted approach among Python developers working in a Windows environment? Carl I don't know that you'll find a common approach. I use Subversion for version control. For larger projects, I use Eclipse with the Pydev plugin for editing, and the Subclipse plugin for talking to Subversion. For smaller things, I usually just edit with SciTE and use the TortoiseSVN Explorer extension or the command-line utilities for checkins and updates. Peace, Joe -- http://mail.python.org/mailman/listinfo/python-list
Re: Python versus Perl ?
Caleb Hattingh wrote: As you might imagine, I think about this constantly. However, there are many other issues that make it complicated, such as having to work in a team where the average guy knows pascal well (we're just a bunch of chemical engineers), but has never even heard of python. Plus, were I to go this type of route, I would almost definitely code the binary modules in Delphi or FreePascal, make a DLL and use ctypes to call it. I do not know C and have no desire to learn now :)On the other hand, I know pascal quite well. keep well Caleb You could always code Python extensions directly in Delphi: http://membres.lycos.fr/marat/delphi/python.htm http://www.atug.com/andypatterns/PythonDelphiLatest.htm Demo09 (look in demodll.dpr & module.pas) in the download tells you how. Peace, Joe -- http://mail.python.org/mailman/listinfo/python-list
Re: python without OO
Timo Virkkala wrote: This guy has got to be a troll. No other way to understand. -- Timo Virkkala Not a troll, just another case of premature optimization run amok. -- http://mail.python.org/mailman/listinfo/python-list
Re: The best way to do web apps with Python?
worzel wrote: What is the best way to web developemnt with Python? Is there anything close to PHP style in-page script placement that can create and use other Python objects? I am not really interested in Zope (I believe that is more a CMS than anything else?) I am also looking for something a little more structured than a series of CGI Scripts. While on the topic - what is the expectataion of Python for this kind of stuff? Would one use Python for certain other things but turn to PHP for web apps - or would one use their Python skills in place of PHP? TIA You may want to look here for some thoughts on the matter: http://pyre.third-bit.com/pyweb/index.html I lean towards Quixote and/or CherryPy, with ZODB as the storage. Both are conceptually similar (I'm comparing v2 of both), but I favor Quixote just slightly more, mostly for Quixote's better form handling. Cheetah is a very nice templating package, but in Quixote I just use its own PTL, since it's built-in. If you wanted to stick with PHP for some reason, Drupal is a very nicely designed framework (or CivicSpace, which is developed in parallel with Drupal, with a number of added-on features). Quixote: http://www.mems-exchange.org/software/quixote/ CherryPy: http://www.cherrypy.org/ ZODB: http://zope.org/Wikis/ZODB/FrontPage Cheetah: http://www.cheetahtemplate.org/ Drupal: http://www.drupal.org/ CivicSpace: http://www.civicspacelabs.org/ jf -- http://mail.python.org/mailman/listinfo/python-list