Recommended exception for objects that can't be pickled

2014-04-21 Thread Stefan Schwarzer
Hi, Recently, I got a request [1] to support pickling of `FTPHost` instances in my `ftplib` library. I explained in the ticket why I think it's a bad idea and now want to make explicit that `FTPHost` objects can't be pickled. The usual way to do this seems to be defining a `__getstate__` method a

[ANN] ftputil 3.0a1 released

2013-09-29 Thread Stefan Schwarzer
ftputil 3.0a1 is now available from http://ftputil.sschwarzer.net/download . Changes since version 2.8 - Note: This version of ftputil is _not_ backward-compatible with earlier versions.See the links below for information on adapting existing client code. - This version a

Re: Grammar question: Englisn and Python: qualified names

2013-04-14 Thread Stefan Schwarzer
Hi Chris, On 2013-04-14 23:50, Chris Angelico wrote: > Quirky question time! > > When you read out a qualified name, eg collections.OrderedDict, do you > read the qualifier ("collections dot ordered dict"), or do you elide > it ("ordered dict")? I ask because it makes a difference to talking > ab

Re: API design for Python 2 / 3 compatibility

2013-04-14 Thread Stefan Schwarzer
Terry, Ethan: Thanks a lot for your excellent advice. :-) On 2013-04-13 19:32, Terry Jan Reedy wrote: > Approach 2 matches (or should match) io.open, which became > builtin open in Python 3. I would simply document that > ftp_host.open mimics io.open in the same way that > ftp_host.chdir, etceter

API design for Python 2 / 3 compatibility

2013-04-13 Thread Stefan Schwarzer
Hello, I'm currently changing the FTP client library ftputil [1] so that the same code of the library works with Python 2 (2.6 and up) and Python 3. (At the moment the code is for Python 2 only.) I've run into a API design issue where I don't know which API I should offer ftputil users under Pytho

Re: Naming future objects and their methods

2012-04-16 Thread Stefan Schwarzer
ut in my reader I only saw one answer in the newsgroup.) Stefan Schwarzer wrote: > I wrote a `Connection` class that can be found at [1]. A > `Connection` object has a method `put_bytes(data)` which > returns a "future" [2]. The data will be sent asynchronously > by a thread

Naming future objects and their methods

2012-04-14 Thread Stefan Schwarzer
Hello, I wrote a `Connection` class that can be found at [1]. A `Connection` object has a method `put_bytes(data)` which returns a "future" [2]. The data will be sent asynchronously by a thread attached to the connection object. The future object returned by `put_bytes` has a `was_sent` method wh

Re: Python Gotcha's?

2012-04-09 Thread Stefan Schwarzer
Hi Miki, On 2012-04-05 00:34, Miki Tebeka wrote: > I'm going to give a "Python Gotcha's" talk at work. > If you have an interesting/common "Gotcha" (warts/dark corners ...) please > share. > > (Note that I want over http://wiki.python.org/moin/PythonWarts already). I gave a somewhat similar tal

Re: using python ftp

2010-12-30 Thread Stefan Schwarzer
Hello Matt, On 2010-12-23 01:03, Matt Funk wrote: > i was wondering whether someone can point me whether the following > already exists. > > I want to connect to a server , download various files (for whose name i > want to be able to use a wildcard), and store those files in a given > location o

Re: Tools for turning Python code into XMI?

2010-11-05 Thread Stefan Schwarzer
Hi Lawrence, I missed your answer because I didn't expect someone to respond after all this time. :-) On 2010-10-30 04:07, Lawrence D'Oliveiro wrote: >> I'm looking for a tool which can read Python files and write >> a corresponding XMI file for import into UML tools. > > UML ... isn’t that some

Re: How do I chain methods?

2010-10-25 Thread Stefan Schwarzer
Hi Steve and others, On 2010-10-25 06:08, Steve Holden wrote: > On 10/24/2010 11:42 PM, Chris Rebert wrote: >> On Sun, Oct 24, 2010 at 4:11 PM, James Mills >> wrote: >>> I don't agree but anyway... I've just not seen it commonly used >>> amongst python programmers. >> >> If Python wanted to encou

Re: yield all entries of an iterable

2010-10-24 Thread Stefan Schwarzer
Hi Cameron, On 2010-10-25 01:08, Cameron Simpson wrote: > On 24Oct2010 20:58, Stefan Schwarzer wrote: > | On 2010-10-21 00:27, Sebastian wrote: > | > Is there a simpler way to yield all elements of a sequence than this? > | > for x in xs: > | > yield x > | > |

Re: yield all entries of an iterable

2010-10-24 Thread Stefan Schwarzer
Hi Sebastian, On 2010-10-21 00:27, Sebastian wrote: > Is there a simpler way to yield all elements of a sequence than this? > for x in xs: > yield x Can you give an example where you would need this? Can't you just iterate over the sequence? If you really need an iterator, you can use `iter(s

Tools for turning Python code into XMI?

2010-10-24 Thread Stefan Schwarzer
Hello, I'm looking for a tool which can read Python files and write a corresponding XMI file for import into UML tools. Ideally, the conversion tool should: - be open source or freeware - be available for Linux - be a command line tool - allow to specify exactly the Python files that should t

Re: About __class__ of an int literal

2010-09-28 Thread Stefan Schwarzer
Hello Alex, On 2010-09-28 11:27, AlexWalk wrote: > In python 3.1.2(I'm using windows edition, 32bit), > accessing __class__ of an int literal will raise a > SyntaxException, while other literals will not. For > example. 1.__class__ is an error, while 1.1.__class__ runs > ok. > > I searched the p

Re: creating python daemon ?

2010-09-26 Thread Stefan Schwarzer
Hi Daniel, On 2010-09-23 07:30, vineet daniel wrote: > On Sep 22, 2:20 pm, de...@web.de (Diez B. Roggisch) wrote: >> vineet daniel writes: >>> On Sep 21, 9:47 pm, de...@web.de (Diez B. Roggisch) wrote: vineet daniel writes: > code that I am using is as follows : >> > #! /usr/bin/env

Re: sequence multiplied by -1

2010-09-25 Thread Stefan Schwarzer
Hi Terry, On 2010-09-25 19:24, Terry Reedy wrote: > On 9/25/2010 4:22 AM, Yingjie Lan wrote: > There is already a builtin reversed() function whose output can be > multiplied. Seemingly, it can't: $ python Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) [GCC 4.4.3] on linux2 Type "help

Re: sequence multiplied by -1

2010-09-25 Thread Stefan Schwarzer
Hi, On 2010-09-25 15:54, Yingjie Lan wrote: > The first one is simpler (4 chars v.s. 9 chars). One thing is whether a certain form is shorter, another thing to take into account is how often you need the functionality. > I thought it was also intuitive because if you multiply > a vector by -1, y

Re: sequence multiplied by -1

2010-09-25 Thread Stefan Schwarzer
Hi, On 2010-09-25 14:11, Yingjie Lan wrote: > Having more than one way of doing things sometimes is good. In my opinion this _isn't_ a situation where it's good. :) L[::-1] is only marginally longer than -1 * L I think this small gain doesn't justify "violating" this "Python Zen" rule

Design: Module interface vs. library interface

2010-09-11 Thread Stefan Schwarzer
Hello, I maintain ftputil [1], an FTP client library. Users of the library may use it like this: | import ftputil | | with ftputil.FTPHost(server, userid, password) as ftp_host: | # for example, make a remote file and read its content | with ftp_host.open("remote_name", "rb") as remote_f

Re: bool constructor is inconsistent?

2010-09-10 Thread Stefan Schwarzer
Hi Neal, On 2010-09-10 20:23, Neal Becker wrote: > IN [3]: bool('False') > Out[3]: True If you consider strings, only an empty string has a false value. So the string 'False' which is non-empty, results in a true boolean value. For example, you can use if my_string: ... to execute

Re: Help needed - function apparently global cannot be called.

2010-09-07 Thread Stefan Schwarzer
Hi Ian, On 2010-09-07 12:18, Ian Hobson wrote: > f = open('d:\logfile.txt','a') Just a note: Using a backslash in a non-raw string will get you in trouble as soon as the backslash is followed by a character which makes a special character sequence, like "\n". For example, f = open('d:\nice_

Re: doctest annoyance/puzzle

2010-09-05 Thread Stefan Schwarzer
Hi Steven, On 2010-09-05 17:30, Steven D'Aprano wrote: > I run the doctests with: > > python2.6 -m doctest examples.txt > > and the first example passes, but the second fails with NameError: > make_spam not defined. I run my doctests by calling doctest.testfile(filename) for each file in

Re: Is there a Python equivalent to Perl's File::Listing::parse_dir

2010-09-02 Thread Stefan Schwarzer
Hi John, On 2010-08-11 20:24, John Nagle wrote: >Perl has a function which will take a remote directory page, in > the form that most web sites return for a file directory, and > parse it into a useful form: > > http://www.xav.com/perl/site/lib/File/Listing.html > > This is especially

Re: Saving (unusual) linux filenames

2010-08-31 Thread Stefan Schwarzer
Hi Grant, On 2010-08-31 20:49, Grant Edwards wrote: > How many filenames contain ","? CVS repository files end with ,v . However, just let's agree that nobody uses CVS anymore. :-) > Not many, but the OP wants his > program to be bulletproof. Can't fault him for that. What about using the csv

Re: Functions continuing to ru after returning something?

2010-08-31 Thread Stefan Schwarzer
Hi, On 2010-08-31 02:05, Bradley Hintze wrote: > I may be having a brain fart, but is it at all possible to have a > function first return a value then continue its calculation. Like this > simple example: > > my_var = 5 > def my_function(): > return my_var > my_var +=1 > > This obviousl

Re: Confused: Newbie Function Calls

2010-08-30 Thread Stefan Schwarzer
Hi Pinku, On 2010-08-11 21:35, Pinku Surana wrote: > Even though I used the same name "x" for a local and global variable, > they are actually completely different. When I call "fun(x)" it COPIES > the global value of "x" into the local variable "x" in "fun". [...] The global value isn't copied w

Re: ftplib limitations?

2010-08-28 Thread Stefan Schwarzer
Hi Lawrence, On 2010-08-28 01:49, Lawrence D'Oliveiro wrote: >> Now it may be that the data connection, after having started >> the transfer, works as it should, but the control connection >> times out because the duration of the transfer is too long. > > It might not be the fault of the FTP serv

Re: Writing byte stream as jpeg format to disk

2010-08-26 Thread Stefan Schwarzer
Hi Navkirat, On 2010-08-26 19:22, Navkirat Singh wrote: > I am programming a webserver, I receive a jpeg file with > the POST method.The file (.jpeg) is encoded in bytes, I > parse the bytes by decoding them to a string. I wanted to > know how i could write the file (now a string) as a jpeg > imag

Re: ftplib limitations?

2010-08-25 Thread Stefan Schwarzer
Hi durumdara, On 2010-08-25 11:18, durumdara wrote: > On aug. 25, 08:07, Stefan Schwarzer wrote: >> >> The file is 2 GB in size and is fully transferred, without >> blocking or an error message. The status message from the >> server is '226-File successfully tr

Re: ftplib limitations?

2010-08-25 Thread Stefan Schwarzer
Hi durumdara, On 2010-08-25 09:43, durumdara wrote: >> I can imagine the error message (a full traceback if >> possible) would help to say a bit more about the cause of >> the problem and maybe what to do about it. > > This was: > > Filename: "Repositories 20100824_101805 (Teljes).zip" Size: 153

Re: ftplib limitations?

2010-08-24 Thread Stefan Schwarzer
Hi durumdara, On 2010-08-24 16:29, Stefan Schwarzer wrote: >> I experienced some problem. >> The server is Windows and FileZilla, the client is Win7 and Python2.6. >> When I got a file with size 1 303 318 662 byte, python is halt on >> "retrbinary" line

Re: equivalent of source in python?

2010-08-24 Thread Stefan Schwarzer
Hi Astan, On 2010-08-24 21:18, Astan Chee wrote: > I'm trying to convert my tcsh script to python and am stuck at one part, > particularly the part of the script that looks like this: > > #!/bin/tcsh > setenv LSFLOG /var/tmp/lsf_log > source /etc/setup > unalias cp > umask 0 > env >> ${AFLOG} >

Re: ftplib limitations?

2010-08-24 Thread Stefan Schwarzer
Hi durumdara, On 2010-08-24 11:21, durumdara wrote: > def CallBack(Data): > d['size'] = d['size'] + len(Data) > d['buffer'].append(Data) > percent = (d['size'] / float(fsize)) * 100 > percentp10 = int(percent/10) > if percentp10 > d['lastpercentp10']: >

Re: Open a command pipe for reading

2010-08-23 Thread Stefan Schwarzer
Hi Rodrick, On 2010-08-17 18:40, Rodrick Brown wrote: > I have a fairly large file 1-2GB in size that I need to > process line by line but I first need to convert the file > to text using a 3rd party tool that prints the records > also line by line. > > I've tried using Popen to do this with no l

Re: A question to experienced Pythoneers

2010-08-20 Thread Stefan Schwarzer
Hi Rony, On 2010-08-20 10:16, Rony wrote: > Here's the story : > I've been hired by a company as a consultant to reorganise there > development department. > The actual situation is : > The manager of the development has been fired, main reason (what they > told me) is that they have big big troub

Re: A question to experienced Pythoneers

2010-08-20 Thread Stefan Schwarzer
Hi Lawrence, On 2010-08-20 13:11, Lawrence D'Oliveiro wrote: > In message > <8d1b76b7-1ba3-49c5-97cf-dc3837050...@y11g2000yqm.googlegroups.com>, Rony > wrote: > >> The manager of the development has been fired, main reason (what they >> told me) is that they have big big troubles in keeping deadli

Re: String substitution VS proper mysql escaping

2010-08-19 Thread Stefan Schwarzer
Hi Νίκος, On 2010-08-19 09:10, Νίκος wrote: > On 18 Αύγ, 12:50, Cameron Simpson wrote: >> >> ("nikos",) is a single element tuple. >> ["nikos"] is a single element list. >> ["nikos",] is also a single element list, just written like the tuple. > > It makes more sense if i: > > "nikos" is just a

Re: 79 chars or more?

2010-08-18 Thread Stefan Schwarzer
Hi Lie, On 2010-08-18 12:02, Lie Ryan wrote: > On 08/17/10 12:59, AK wrote: >> On 08/16/2010 10:42 PM, James Mills wrote: >>> My personal opinion (despite monitors being wider) is >>> the horizontal scrolling isn't worth it. Stick to a 80-char width. >> >> But.. why horizontal scrolling, isn't aut

Re: Call Java Code from python

2010-08-18 Thread Stefan Schwarzer
Hi Bidda, On 2010-08-18 09:19, Bidda Gowda wrote: > I have a project coming up where i have to integrate our existing > Python based web application with Java Programs. Basically i should be > able to call Java programs which comes in the form of jars. Whats the > best way to call these jars from

Re: 79 chars or more?

2010-08-17 Thread Stefan Schwarzer
Hi Andrei, On 2010-08-17 18:43, AK wrote: > But let me ask you, would you really prefer to have: > self.expiration_date = translate_date( find(response, 'MPNExpirationDate').text, '%Y-%m-%d', '%m%d%Y') > > (or the 4-line version of this abov

Re: 79 chars or more?

2010-08-17 Thread Stefan Schwarzer
On 2010-08-17 17:44, AK wrote: > On 08/17/2010 10:28 AM, Stefan Schwarzer wrote: >> I'd probably reformat this to >> >>self.expiration_date = translate_date( >> find(response, 'MPNExpirationDate').text, >>

Re: 79 chars or more?

2010-08-17 Thread Stefan Schwarzer
Hi Neil, On 2010-08-17 14:42, Neil Cerutti wrote: > On 2010-08-17, Michael Torrie wrote: >> In general if I find myself consistently going longer than 75 >> or 80 characters, I need to refactor my code to make it more >> manageable. If I have to scroll up five pages to find the >> beginning of a

Re: Opposite of split

2010-08-17 Thread Stefan Schwarzer
Hi Alex, On 2010-08-16 18:44, Alex van der Spek wrote: > Anybody catches any other ways to improve my program (attached), you are > most welcome. Help me learn, that is one of the objectives of this > newsgroup, right? Or is it all about exchanging the next to impossible > solution to the never

Re: Help to convert Number to String

2010-08-13 Thread Stefan Schwarzer
Hi Vamsi, On 2010-08-13 22:50, Vamsi wrote: > I am trying to count the number of lines in a file and insert into > the file but getting the error message "TypeError: must be string or > read-only character buffer, not int", Could you please help me how to > correct this? Which Python version do

Re: How do I get number of files in a particular directory.

2010-08-13 Thread Stefan Schwarzer
On 2010-08-13 11:18, blur959 wrote: > import os > > directory = raw_input("Please input file directory. \n\n") > s = raw_input("Please input a name to replace. \n\n") > ext = raw_input("input file ext") > > for files in os.listdir(directory): > if ext in files: > file_number = len(fil

Re: __class__ of what

2010-08-12 Thread Stefan Schwarzer
Hello Jean-Michel, On 2010-08-12 16:06, Jean-Michel Pichavant wrote: > Eric J. Van der Velden wrote: > Should be > > class C: > n = 0 > def __init__(self): >self.__class__.n+=1 >C.n+=1 # equivalent to this line (I prefer this one, more > readable, less refactor-friendly)

Re: Weird Python behaviour

2010-08-10 Thread Stefan Schwarzer
Hi, On 2010-08-10 17:01, Francesco Bochicchio wrote: > There used to be a very nice (also graphic) explanationor this > somewhere on the web, but my googling skills failed me this time, > so instead I'll show you the concept using your own code: Probably this isn't the page you're referring to, b

Re: Python -Vs- Ruby: A regexp match to the death!

2010-08-09 Thread Stefan Schwarzer
On 2010-08-09 23:43, Stefan Schwarzer wrote: > I got that traceback as soon as I typed in "%paste" and > pressed enter, without pasting anything in the terminal. > I had assumed it works like :paste in Vim, activating a I meant ":set paste" of course. Stefan -- h

Re: Python -Vs- Ruby: A regexp match to the death!

2010-08-09 Thread Stefan Schwarzer
Hi Robert, On 2010-08-09 22:23, Robert Kern wrote: > On 2010-08-09 06:42 , Stefan Schwarzer wrote: >> Unfortunatey, when I enter >> >>In [2]: %paste >> >> at the prompt it gives me (before I pasted

Re: Python -Vs- Ruby: A regexp match to the death!

2010-08-09 Thread Stefan Schwarzer
Hi Steven, On 2010-08-09 10:21, Steven D'Aprano wrote: > And that it's quite finicky about blank lines between methods and inside > functions. Makes it hard to paste code directly into the interpreter. > > And that pasting doesn't strip out any leading prompts. It needs a good > doctest mode.

Re: easy question on parsing python: "is not None"

2010-08-08 Thread Stefan Schwarzer
Hi Ben, On 2010-08-08 01:16, Ben Finney wrote: > Don't use strings for such values. The data isn't going to be used, so > there's no sense using a semantically rich data type like a string. > > Instead, use an ‘object’ instance; then, the only way to get a binding > that will compare equal is to

Re: default behavior

2010-08-07 Thread Stefan Schwarzer
On 2010-07-31 05:47, Steven D'Aprano wrote: > On Fri, 30 Jul 2010 08:34:52 -0400, wheres pythonmonks wrote: > It does re-use the same underlying data. > > >>> from collections import defaultdict as dd > >>> x = dd(list) > >>> x[1].append(1) > >>> x > defaultdict(, {1: [1]}) > >>> y = dict(x) > >>>

Re: easy question on parsing python: "is not None"

2010-08-07 Thread Stefan Schwarzer
Hi Steven, On 2010-08-07 00:28, Steven D'Aprano wrote: > On Fri, 06 Aug 2010 15:37:04 +0200, Stefan Schwarzer wrote: >>> Plus, I believe the >>> "==" operator will check if the variables point to the same object. >> >> No, that's what `is` is

Re: easy question on parsing python: "is not None"

2010-08-06 Thread Stefan Schwarzer
Hello Peter, On 2010-08-06 19:20, Peter Pearson wrote: > On Fri, 06 Aug 2010 15:37:04 +0200, Stefan Schwarzer wrote: > [snip] >> I can imagine a case where you might want to compare a >> string with `is`: >> >> FORWARD = "forward" >> BACKWARD

Re: easy question on parsing python: "is not None"

2010-08-06 Thread Stefan Schwarzer
Hi DG, On 2010-08-06 14:28, DG wrote: > I've always thought of it as you don't compare strings with "is", you > *should* use == The reasoning is that you don't know if that string > instance is the only one in memory. I've heard as an implementation > detail, since strings are immutable, that Py

Re: simple integer subclass

2010-08-05 Thread Stefan Schwarzer
Hi Andreas, On 2010-08-03 12:15, Andreas Pfrengle wrote: > On 3 Aug., 03:22, Carl Banks wrote:> > Thinking about it, it might really be dangerous to coerce always to > int1, since sometimes I might want a normal int as result (I can't > tell yet for sure). Yes, that way your problem may shift fr

Re: __init__ as a lambda

2010-08-04 Thread Stefan Schwarzer
Hi Eric, On 2010-08-04 21:58, Eric J. Van der Velden wrote: > class C: > def __init__(self,name):self.name=name > > I was wondering if I could make the __init__ a lambda function, but > > class C: > __init__=lambda self,self.name:None > > and then later, > > C('Hello') > > does not work; th

[ANN] Websourcebrowser 0.4a released

2010-08-04 Thread Stefan Schwarzer
Hello, I'm happy to announce the release of Websourcebrowser 0.4a. Websourcebrowser is a program intended to get a quick overview of a project's source code. The program is controlled from a web browser which displays a directory tree and a source code file side by side. The homepage of the proj

[ANN] ftputil 2.2.3 released

2007-07-22 Thread Stefan Schwarzer
d BSD license (see http://www.opensource.org/licenses/bsd-license.php ). Stefan -- Dr.-Ing. Stefan Schwarzer SSchwarzer.com - Softwareentwicklung für Technik und Wissenschaft http://sschwarzer.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Needed: FTP Upload Directory Tree script

2007-06-10 Thread Stefan Schwarzer
Hello Ian, On 2007-06-10 10:01, IanC wrote: > Does anyone know of a function or script to upload an entire > subdirectory tree from a local file space to an FTP server? > > The Python distribution comes with "ftpmirror.py", which performs > a mirror download of a directory tree, but I need the "U

[ANN] ftputil 2.2.1

2007-01-27 Thread Stefan Schwarzer
revised BSD license (see http://www.opensource.org/licenses/bsd-license.php ). Stefan -- Dr.-Ing. Stefan Schwarzer SSchwarzer.com - Softwareentwicklung für Technik und Wissenschaft http://sschwarzer.com http://ftputil.sschwarzer.net -- http://mail.python.org/mailman/listinfo/python-list

Re: clarification on open file modes

2007-01-06 Thread Stefan Schwarzer
On 2007-01-05 03:46, tubby wrote: > Is this the safest, most portable way to open files on any platform: > > fp = open(file_name, 'rb') > fp.close() > > I understand that doing the following on Windows to a binary file (a > jpeg or exe files for example) can cause file corruption, is that correct?

Re: Why less emphasis on private data?

2007-01-06 Thread Stefan Schwarzer
On 2007-01-07 01:54, BJörn Lindqvist wrote: > Google for "python for consenting adults" > > Or ask yourself the opposite question. Why does C++ and C# prefer more > private data? It is given that emphasizing private data > (encapsulation) leads to more internal complexity and more lines of > code b

Re: How to get file name on a remote server with ftplib?

2007-01-05 Thread Stefan Schwarzer
>>> file_names ['wanted_filename'] >>> file_name = file_names[0] >>> host.download(file_name, file_name, "b") >>> host.close() Ok, I admit this isn't a pure-ftplib solution. :-) Stefan -- Dr.-Ing. Stefan Schwarzer SSchwarzer.com - Softwareentwicklung für Technik und Wissenschaft http://sschwarzer.com -- http://mail.python.org/mailman/listinfo/python-list

Re: code optimization (calc PI)

2007-01-03 Thread Stefan Schwarzer
ython2006.pdf Stefan -- Dr.-Ing. Stefan Schwarzer SSchwarzer.com - Softwareentwicklung für Technik und Wissenschaft http://sschwarzer.com -- http://mail.python.org/mailman/listinfo/python-list

Re: simple ftputil ssl client

2007-01-02 Thread Stefan Schwarzer
se M2Crypto, try to make sure that you have a class which is compatible with ftplib.FTP. You can pass such a class as session_factory to ftputil.FTPHost's constructor. If you don't have such a class, you might be able to write it yourself. Stefan -- Dr.-Ing. Stefan Schwarzer SSchwarzer.c

Re: How to depress the output of an external module ?

2006-12-26 Thread Stefan Schwarzer
Hi Luis, Luis Armendariz wrote: > There's no need for savestdout. There's a backup copy in sys.__stdout__ Depending on the code that ran before the call to the function run_without_stdout, sys.stdout may not be the same as sys.__stdout__ . Of course, you also have to be careful regarding threads

[ANN] ftputil 2.2 released

2006-12-25 Thread Stefan Schwarzer
Source software, released under the revised BSD license (see http://www.opensource.org/licenses/bsd-license.php ). Stefan -- Dr.-Ing. Stefan Schwarzer SSchwarzer.com - Softwareentwicklung f??r Technik und Wissenschaft http://sschwarzer.com -- http://mail.python.org/mailman/listinfo/python-list

Re: FTP over SSL

2006-10-24 Thread Stefan Schwarzer
On 2006-10-20 15:50, Tor Erik Soenvisen wrote: > Anyone know about existing code supporting FTP over SSL? > I guess pycurl http://pycurl.sourceforge.net/ could be used, but that > requires knowledge of libcurl, which I haven't. Possibly you could use M2Crypto [1]. It has a FTP_TLS class in module

Re: Data sticking around too long

2006-09-07 Thread Stefan Schwarzer
Hello Matimus, On 2006-09-07 00:07, Matimus wrote: > Someone correct me if I'm wrong (sometimes I get the terms mixed up) > but I believe that what you are seeing is due to 'number' being an > immutable type. This means that its value cannot be changed and thus > each assignment is effectively cre

Re: programming is hard

2006-08-03 Thread Stefan Schwarzer
Hi placid: On 2006-08-03 14:56, placid wrote: > this site is contains code snippets for various languages and python > does not have many code snippet posters. Probably that's because there's a Python "snippet repository" at http://aspn.activestate.com/ASPN/Python/Cookbook/ :-) It wouldn't make

Re: Replace Whole Object Through Object Method

2006-07-01 Thread Stefan Schwarzer
Hi Bruno :) On 2006-06-27 10:30, Bruno Desthuilliers wrote: > FWIW, a good part of the canonical design patterns are mostly workaround > the lack of flexibility in languages like C++ and Java. May be, but that doesn't exclude that some patterns are also useful in Python. :-) > The Strategy > pat

Re: ftp connection and commands (directroy size, etc)

2006-04-14 Thread Stefan Schwarzer
Hi Arne On 2006-04-12 18:05, Arne wrote: > I am working on Windows XP and I want to do the following: > > 1. Connecting to a server using ftp > 2. Getting the directory structure and the size of each directory in the > root > 3. Getting the owner of a file > > All these steps I want to do with

Re: ftp putting information in a variable

2006-04-11 Thread Stefan Schwarzer
Hi Arne, On 2006-04-08 12:44, Arne wrote: > I am looking for a way to put ftp returns in a variable. > > My OS is XP and I want to get the owner of a file. So I have to > > connect to ftp. But I am stacked with how I can receive this > information and put it in a variable. you can use a library t

[ANN] ftputil 2.1 released

2006-03-30 Thread Stefan Schwarzer
ftputil 2.1 is now available from http://ftputil.sschwarzer.net/download . Changes since version 2.0 - - Added new methods to the FTPHost class, namely makedirs, walk, rmtree. - The FTP server directory format ("Unix" vs. "Windows") is now set automatically (thanks to

Non-GUI source code browser with file system tree view

2006-03-30 Thread Stefan Schwarzer
Hello, from time to time I want to inspect the source code of projects on remote computers.(*) I've googled for one or two hours but didn't find anything helpful. :-/ I'm looking for something like IDLE's path browser - i. e. a tree view and file view side-by-side - but with the following differen

Re: i have error then use ftplib

2006-03-30 Thread Stefan Schwarzer
Hello nazarianin, On 2006-03-30 09:35, 5>=>2 ;5:A59 wrote: > from ftplib import FTP > def handleDownload(block): > file.write(block) > print "." > > file = open('1', 'wb') > ftp = FTP('ftp.utk.ru') > ftp.set_pasv(1) > ftp.login() > ftp.retrlines('LIST') > [...] > and have this error mes

Avoiding FTP server timeout for files based on sockets (long posting)

2006-02-08 Thread Stefan Schwarzer
Hi all! For my FTP library module ftputil [1], some users have asked for a way to avoid server timeouts (FTP status code 421). But I haven't found out yet how I can do this in all cases. I try to explain the problem in more detail. The following is rather special and probably not so easy to under

Re: Problems with python and threads under Freebsd

2005-02-07 Thread Stefan Schwarzer
snacktime wrote: > I am consistantly getting seg faults and bus errors when running a > multi threaded python application under 5.3-release-p2. Python was > built from the port(python 2.4) with threading enabled. I had similar problems some time ago. The solution/workaround was to remove the thre