Re: Defining a Python enum in a C extension - am I doing this right?

2021-08-03 Thread Sean DiZazzo
On Tuesday, August 3, 2021 at 3:04:19 AM UTC-7, Bartosz Golaszewski wrote: > On Sat, Jul 31, 2021 at 3:01 PM Bartosz Golaszewski wrote: > > > > On Fri, Jul 30, 2021 at 2:41 PM Serhiy Storchaka wrote: > > > > > > 23.07.21 11:20, Bartosz Golaszewski пише: > > > > I'm working on a Python C exte

Re: [Errno 2] No such file or directory:

2021-07-30 Thread Sean DiZazzo
On Thursday, July 29, 2021 at 7:42:58 AM UTC-7, joseph pareti wrote: > indeed. There are better options than the one I attempted. Thanks for the > advice > > Am Mi., 28. Juli 2021 um 18:19 Uhr schrieb Chris Angelico >: > > On Thu, Jul 29, 2021 at 2:10 AM joseph pareti > > wrote: > > > > > >

Re: a simple question

2021-07-29 Thread Sean DiZazzo
On Tuesday, July 27, 2021 at 5:05:27 AM UTC-7, Terry Reedy wrote: > On 7/26/2021 6:19 PM, Glenn Wilson via Python-list wrote: > > I recently downloaded the latest version of python, 3.9.6. Everything works > > except, the turtle module. I get an error message every time , I use basic > > command

Re: Create an alias to an attribute on superclass

2018-02-01 Thread Sean DiZazzo
On Thursday, February 1, 2018 at 10:23:06 AM UTC-8, Sean DiZazzo wrote: > Hi! > > I basically just want to create an alias to an attribute on an item's > superclass. So that after I create the subclass object, I can access the > alias attribute to get the value back. >

Re: Create an alias to an attribute on superclass

2018-02-01 Thread Sean DiZazzo
On Thursday, February 1, 2018 at 10:37:32 AM UTC-8, Chris Angelico wrote: > On Fri, Feb 2, 2018 at 5:22 AM, Sean DiZazzo wrote: > > Hi! > > > > I basically just want to create an alias to an attribute on an item's > > superclass. So that after I create the s

Create an alias to an attribute on superclass

2018-02-01 Thread Sean DiZazzo
Hi! I basically just want to create an alias to an attribute on an item's superclass. So that after I create the subclass object, I can access the alias attribute to get the value back. class Superclass(object): def __init__(self, value): """ I want to pass x by refere

Re: "tkinter"

2017-09-13 Thread Sean DiZazzo
On Wednesday, September 13, 2017 at 7:21:25 PM UTC-7, Grant Edwards wrote: > On 2017-09-13, Ben Finney wrote: > > > The toolkit in question is named “tk”, which I have only ever known to > > be pronounced “tee kay”. > > > > The rest of the word is an abbreviation of “interface”. > > > > So, to me

Re: the core values of the Python "platform"

2017-09-13 Thread Sean DiZazzo
On Wednesday, September 13, 2017 at 6:16:58 AM UTC-7, leam hall wrote: > On Wed, Sep 13, 2017 at 9:08 AM, Darin Gordon wrote: > > > Bryan Cantrill gave an interesting talk recently at a Node conference about > > "platform values" [1]. The talk lead me to think about what the core values > > of th

Re: A good way to unpack a matrix

2017-09-13 Thread Sean DiZazzo
On Wednesday, September 13, 2017 at 7:53:25 PM UTC-7, Andrew Zyman wrote: > hello, > is there a better approach to populating a function in this situation? > > res = self.DB.getPrice(): # returns array of 3x2 always. symbol_id, > symbol, price. > > var1 = self.AFunction(symbols=res[0][2] + '.'

Re: Python dress

2017-09-13 Thread Sean DiZazzo
On Wednesday, September 13, 2017 at 3:02:18 PM UTC-7, bream...@gmail.com wrote: > On Wednesday, September 13, 2017 at 10:43:47 PM UTC+1, Sean DiZazzo wrote: > > On Tuesday, September 12, 2017 at 9:18:12 AM UTC-7, larry@gmail.com > > wrote: > > > Not too many

Re: Python dress

2017-09-13 Thread Sean DiZazzo
On Tuesday, September 12, 2017 at 9:18:12 AM UTC-7, larry@gmail.com wrote: > Not too many females here, but anyway: > > https://svahausa.com/collections/shop-by-interest-1/products/python-code-fit-flare-dress > > (And if any guys want to wear this, there's nothing wrong with that.) I'm going

Re: rmtree message

2017-09-13 Thread Sean DiZazzo
On Wednesday, September 13, 2017 at 12:06:20 PM UTC-7, larry@gmail.com wrote: > I have a script that creates a tmp dir, create a lot of files in it, > and when done, does a rmtree on the dir. When it does that I get this > message: > > shell-init: error retrieving current directory: getcwd: c

traceback.format_exc() returns 'None\n'?!

2017-08-31 Thread Sean DiZazzo
Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 12:39:47) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import traceback >>> tb = traceback.format_exc() >>> type(tb) >>> tb 'None\n' >>> Shouldn't it just retur

Re: Bug or intended behavior?

2017-06-03 Thread Sean DiZazzo
On Friday, June 2, 2017 at 10:46:03 AM UTC-7, bob gailer wrote: > On 6/2/2017 1:28 PM, Jussi Piitulainen wrote: > > sean.diza...@gmail.com writes: > > > >> Can someone please explain this to me? Thanks in advance! > >> > >> ~Sean > >> > >> > >> Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 12:

Bug or intended behavior?

2017-06-02 Thread sean . dizazzo
Can someone please explain this to me? Thanks in advance! ~Sean Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 12:39:47) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> print "foo %s" % 1-2 Traceback (most rece

Re: ftplib - Did the whole file get sent?

2010-10-23 Thread Sean DiZazzo
On Oct 22, 10:48 pm, Steven D'Aprano wrote: > On Fri, 22 Oct 2010 22:03:38 -0700, Sean DiZazzo wrote: > > How can I assure him (and the client) that the transfer completed > > successfully like my log shows? > > "It has worked well for many years, there are no

ftplib - Did the whole file get sent?

2010-10-22 Thread Sean DiZazzo
Hi, I have some scripts that send files via ftplib to a client's ftp site. The scripts have generally worked great for a few years. Recently, the client complained that only part of an important file made it to their server. My boss got this complaint and brought it to my attention. The first

Re: Help with suds: HTTP Error 401

2010-06-19 Thread Sean DiZazzo
On Jun 11, 5:27 am, Eric von Horst wrote: > I have small program that tries to open a wsdl. When I execute the > program I am getting 'suds.transport.TransportError: HTTP Error 401: > Unauthorized' Hey Eric, Im a suds noob as well. I found some code that led me to the below example. It worked

Re: getting up arrow in terminal to scroll thought history of python commands

2010-06-13 Thread Sean DiZazzo
On Jun 13, 4:39 pm, Vincent Davis wrote: > On Sun, Jun 13, 2010 at 5:28 PM, Gerry Reno wrote: > > sounds like your keymapping got messed with. > > > you could just: > > set -o vi > > python > > ESC, Ctrl-j > > and now ESC-k and ESC-j will take you back and forth in history (std vi > > editing) >

Re: Drilling down in a dict with "complex" objects

2010-05-24 Thread Sean DiZazzo
On May 24, 9:34 pm, Six wrote: > I am trying to access an objects sub-object attributes. I can boil the > code I am working with down to this problem section: > (snip) > class Pt: >   x = None >   y = None >   def __init__(self, x, y): >     self.x, self.y = x, y >   pass > > class Pts: >   curr_p

Re: recursively remove all the directories and files which begin with '.'

2010-05-16 Thread Sean DiZazzo
On May 14, 8:27 am, albert kao wrote: > On May 14, 11:01 am, J wrote: > > > > > On Fri, May 14, 2010 at 10:53, albert kao wrote: > > > > C:\python>rmdir.py > > > C:\test\com.comp.hw.prod.proj.war\bin > > > ['.svn', 'com'] > > > d .svn > > > dotd C:\test\com.comp.hw.prod.proj.war\bin\.svn > > > T

Re: client to upload big files via https and get progress info

2010-05-13 Thread Sean DiZazzo
On May 13, 9:54 pm, Sean DiZazzo wrote: > On May 13, 9:39 am, News123 wrote: > > > > > Hi Aaaz, > > > Aahz wrote: > > > In article <4bea6b50$0$8925$426a7...@news.free.fr>, > > > News123   wrote: > > >> I'd like to perform huge f

Re: client to upload big files via https and get progress info

2010-05-13 Thread Sean DiZazzo
On May 13, 9:39 am, News123 wrote: > Hi Aaaz, > > Aahz wrote: > > In article <4bea6b50$0$8925$426a7...@news.free.fr>, > > News123   wrote: > >> I'd like to perform huge file uploads via https. > >> I'd like to make sure, > >> - that I can obtain upload progress info (sometimes the nw is very slow)

Re: win32wnet.WNetAddConnection2 to specific network interface?

2010-04-14 Thread Sean DiZazzo
On Apr 14, 9:22 pm, Dennis Lee Bieber wrote: > On Wed, 14 Apr 2010 15:18:11 -0700 (PDT), Sean DiZazzo > declaimed the following in > gmane.comp.python.general: > > > > >     def wnet_connect(self, host, username, password): > >         The presence of "self&q

win32wnet.WNetAddConnection2 to specific network interface?

2010-04-14 Thread Sean DiZazzo
Hi! I have a small app that uses pywin32 to log on to a remote host and send some files around. It works well, but I've found a machine that the app won't work on. The machine is dual-homed, with one interface able to see the server machine, but the other can not. I don't have the exact error b

Re: getopt question

2010-04-09 Thread Sean DiZazzo
On Apr 9, 4:37 pm, Raphael Mayoraz wrote: > Ooops, forgot to attach the file in my first e-mail. Now, here it is. > > > Hello, > > I have some trouble to make getopt.getopt work and the way I want (and > is described in the documentation). >

Re: MySQLdb compiled -- Import issue

2010-03-24 Thread Sean DiZazzo
> You are right. I was trying to import the module sitting on the source > folder :"-). Thanks for your quick response and let me try further. Sweet! I remember it because it confused the hell out of me on at least one past occasion. :) -- http://mail.python.org/mailman/listinfo/python-list

Re: MySQLdb compiled -- Import issue

2010-03-24 Thread Sean DiZazzo
On Mar 24, 7:59 pm, Kurian Thayil wrote: > Hi All, > > I am just a month old with Python and trying to learn CGI with Python. I > was trying to install MySQLdb module in my new CentOS 5.3 box with > Python 2.4.3 default install. I downloaded the tar-ball of MySQLdb > module (MySQL-python-1.2.3c1).

Re: Updates about Tk

2010-02-27 Thread Sean DiZazzo
> Are the new Tk comaprable with other toolkits(Qt, GTK,Wx?)? > Does Tk lack other features compared to the Qt,GTK,Wx...? > (Or: is there things you can't simply do with Tk?) > > Thanks in advance for replying tkinter is a good starting point. You can get some definite benefits going to wx or Qt

Re: Executable problem - correction

2010-02-24 Thread Sean DiZazzo
On Feb 24, 9:22 pm, Gib Bogle wrote: > The program doesn't fail with the write error on the other XP machine, it > actually fails to execute at all, complaining about the configuration > information.  Therefore I'm seeing different behaviour on three XP machines: > > Box 1 (SP2): runs OK > Box 2 (

Re: Question about getmtime

2010-02-19 Thread Sean DiZazzo
On Feb 19, 10:06 am, MRAB wrote: > Brandon wrote: > > Hi everyone, > > > Does copying or moving a file affect the return value of > > os.path.getmtime(path)? > > The modification time of a copied file should be the same as the > original. > > The creation time of a copied file will be the time at

Re: How do you implement a Progress Bar

2010-02-13 Thread Sean DiZazzo
On Feb 12, 11:33 pm, J Wolfe wrote: > I would really appreciate some help with this.  I'm fairly new to > using classes...What am I doing wrong? All I get is a blank window. I > can't seem to figure out how to initialize this Progress Bar. > Study and hack on this: http://uucode.com/texts/pylongo

Re: equivalent of Ruby's Pathname?

2010-02-09 Thread Sean DiZazzo
On Feb 8, 2:36 pm, a...@pythoncraft.com (Aahz) wrote: > In article > , > Sean DiZazzo   wrote: > > >On Feb 3, 6:08=A0pm, alex23 wrote: > > >> There was also a PEP with another possible implementation: > >>http://www.python.org/dev/peps/pep-0355/ > >

Re: Executing Commands From Windows Service

2010-02-09 Thread Sean DiZazzo
On Feb 9, 6:52 am, T wrote: > On Feb 8, 2:25 pm, David Bolen wrote: > > > > > T writes: > > > I have a script, which runs as a Windows service under the LocalSystem > > > account, that I wish to have execute some commands.  Specifically, the > > > program will call plink.exe to create a reverse

Re: Executing Commands From Windows Service

2010-02-08 Thread Sean DiZazzo
> > It's working fine when I run it via " debug" - that's how > I was testing before.  It's when I start the service that it fails - > and you can see that, when you run it with debug, plink.exe runs under > my username.  When I run it as a service, it runs under System... You can have the servic

Re: Executing Commands From Windows Service

2010-02-07 Thread Sean DiZazzo
On Feb 7, 4:57 pm, T wrote: > Thanks for the suggestions -  I think my next step is to try running > it under an admin user account, as you guys both mentioned.  Alf - > you're absolutely right, Microsoft has srvany.exe, which allows you to > run any EXE as a Windows service.  I've done this in th

Re: Executing Commands From Windows Service

2010-02-07 Thread Sean DiZazzo
On Feb 7, 11:02 am, T wrote: > I have a script, which runs as a Windows service under the LocalSystem > account, that I wish to have execute some commands.  Specifically, the > program will call plink.exe to create a reverse SSH tunnel.  Right now > I'm using subprocess.Popen to do so.  When I run

Re: equivalent of Ruby's Pathname?

2010-02-04 Thread Sean DiZazzo
On Feb 3, 6:08 pm, alex23 wrote: > On Feb 4, 8:47 am, Phlip wrote: > > > Yes, calling os.path.walk() and os.path.join() all the time on raw > > strings is fun, but I seem to recall from my Ruby days a class called > > Pathname, which presented an object that behaved like a string at > > need, and

Re: Your beloved python features

2010-02-04 Thread Sean DiZazzo
On Feb 4, 3:03 pm, Julian wrote: > Hello, > > I've asked this question at stackoverflow a few weeks ago, and to make > it clear: this should NOT be a copy of the stackoverflow-thread > "hidden features of Python". > > I want to design a poster for an open source conference, the local > usergroup w

Re: PEP 3147 - new .pyc format

2010-01-31 Thread Sean DiZazzo
> Here is a recent list of magic numbers: > >        Python 2.6a0: 62151 (peephole optimizations and STORE_MAP opcode) >        Python 2.6a1: 62161 (WITH_CLEANUP optimization) >        Python 2.7a0: 62171 (optimize list comprehensions/change LIST_APPEND) >        Python 2.7a0: 62181 (optimize cond

Re: SimpleXMLRPCServer daemon

2010-01-29 Thread Sean DiZazzo
On Jan 29, 7:54 am, Thomas Allen wrote: > I have a script that runs an instance of SimpleXMLRPCServer and in > general it works as expected. In its __del__, it is supposed to clean > up its PID file (written on boot). I have two problems with this > server instance: The first is that tt doesn't al

Re: get error install MySQLdb on Mac OS X

2010-01-28 Thread Sean DiZazzo
On Jan 28, 12:53 pm, "PS.OHM" wrote: > Hello Guys > > I have get some error when i install MySQLdb on Mac OS X > > after i key command $python setup.py build > > rusult is > : > : > error: command 'gcc-4.0' failed with exit status 1 > > How to config this poblem? Please show a little bit more of

Re: Wrap a function

2010-01-28 Thread Sean DiZazzo
On Jan 28, 12:13 pm, Joan Miller wrote: > On 28 ene, 19:58, John Posner wrote: > > > > > On 1/28/2010 2:24 PM, Joan Miller wrote: > > > > On 28 ene, 19:16, Josh Holland  wrote: > > >> On 2010-01-28, Joan Miller  wrote: > > > >>> I've to call to many functions with the format: > > > >> run("cm

Re: Terminal application with non-standard print

2010-01-25 Thread Sean DiZazzo
On Jan 24, 11:27 am, Rémi wrote: > Hello everyone, > > I would like to do a Python application that prints data to stdout, but > not the common way. I do not want the lines to be printed after each > other, but the old lines to be replaced with the new ones, like wget > does it for example (when d

Re: deriving MySQLdb class

2010-01-21 Thread Sean DiZazzo
On Jan 21, 8:17 pm, tekion wrote: > Sean, > I did a little investigation, there are other classes besides > Connection. So, could I only set up a derived class from Connection > and still be able to use the connection to query database and retrieve > data? Im not sure I understand you completely.

Re: deriving MySQLdb class

2010-01-21 Thread Sean DiZazzo
On Jan 21, 8:00 pm, tekion wrote: > Sean, > Thanks.  This is useful.  For future reference, how do I know what > class is in MySQLdb module? You have to explore. ;) I found the MySQLdb module, and looked inside the __init__.py. Then looked for "connect" and followed the trail. -- http://mail.

Re: deriving MySQLdb class

2010-01-21 Thread Sean DiZazzo
On Jan 21, 5:48 pm, tekion wrote: > All, > I am trying to write a class which inherits from MySQLdb class.  Below > is code snippet: > import MySQLdb > import sys > > class  msql_connect(MySQLdb): >     def __init__(self): >         self.host     =  "hostname" >         self.user     = "user" >  

Re: setattr() oddness

2010-01-15 Thread Sean DiZazzo
On Jan 15, 2:22 pm, Terry Reedy wrote: > On 1/15/2010 3:37 PM, Sean DiZazzo wrote: > > > Should the following be legal? > > >>>> class TEST(object): pass > > ... > >>>> t = TEST() > >>>> setattr(t, "", "123&quo

setattr() oddness

2010-01-15 Thread Sean DiZazzo
Should the following be legal? >>> class TEST(object): pass ... >>> t = TEST() >>> setattr(t, "", "123") >>> getattr(t, "") '123' ~Sean -- http://mail.python.org/mailman/listinfo/python-list

Re: PIL how to display multiple images side by side

2010-01-08 Thread Sean DiZazzo
On Jan 8, 1:43 pm, "suresh.amritapuri" wrote: > Hi, > > In PIL, how to display multiple images in say m rows and n colums when > I have m*n images. > > suresh Sounds like a good project to learn PIL with. ~Sean -- http://mail.python.org/mailman/listinfo/python-list

Re: Printing plain text with exact positioning on Windows

2010-01-06 Thread Sean DiZazzo
On Jan 5, 11:40 am, KvS wrote: > On Jan 5, 7:16 pm, Nobody wrote: > > > > > On Tue, 05 Jan 2010 04:40:14 -0800, KvS wrote: > > >> Did you mean borderless printing? > > >> Every printer needs his margins, some more some less. Some printers have > > >> the > > >> ability to do borderless printing

Re: python 2.x and running shell command

2009-12-24 Thread Sean DiZazzo
On Dec 24, 5:34 am, tekion wrote: > On Dec 23, 5:22 pm, Sean DiZazzo wrote: > > > > > On Dec 23, 1:57 pm, tekion wrote: > > > > All, > > > some of the servers I have run python 2.2, which is a drag because I > > > can't use subprocess modu

Re: python 2.x and running shell command

2009-12-23 Thread Sean DiZazzo
On Dec 23, 1:57 pm, tekion wrote: > All, > some of the servers I have run python 2.2, which is a drag because I > can't use subprocess module.  My options that I know of is popen2 > module.  However, it seems it does not have io blocking > capabilities.   So every time run a command I have open an

Re: insert unique data in a list

2009-12-13 Thread Sean DiZazzo
On Dec 13, 8:37 am, mattia wrote: > How can I insert non-duplicate data in a list? I mean, is there a > particular option in the creation of a list that permit me not to use > something like: > def append_unique(l, val): >     if val not in l: >         l.append(val) > > Thanks, > Mattia Check ou

Re: daemon.DaemonContext and logging

2009-12-10 Thread Sean DiZazzo
On Dec 10, 5:37 pm, Sean DiZazzo wrote: > I'm finally getting around to trying out the python-daemon module and > have hit a wall.  I'm trying to set up logging inside of the "with > daemon.DaemonContext" block.  But when I try to use a logger inside > the block i

daemon.DaemonContext and logging

2009-12-10 Thread Sean DiZazzo
I'm finally getting around to trying out the python-daemon module and have hit a wall. I'm trying to set up logging inside of the "with daemon.DaemonContext" block. But when I try to use a logger inside the block it throws an error: ~~ from __future__ import with_

Re: Reading a file that is changing and getting the new lines

2009-12-01 Thread Sean DiZazzo
On Dec 1, 3:09 pm, Ouray Viney wrote: > Problem: > = > I want to read a ASCII text file that can have data appended to it. > > Example scenario:  As the python script is running a user/application > adds new entries to the end of the test case file, example, adds the > following to the fi

Re: extracting info from media files

2009-11-07 Thread Sean DiZazzo
MediaInfo is your best bet. http://mediainfo.sourceforge.net/en ~Sean On Nov 6, 11:59 pm, Michele Simionato wrote: > I would like to extract some simple info from media files, such as > size, resolution, duration, codec. What's the simplest way to do it? > Once in a time there was pymedia but I

Re: substituting list comprehensions for map()

2009-11-02 Thread Sean DiZazzo
On Nov 2, 9:01 pm, Ben Finney wrote: > Anh Hai Trinh writes: > > > > Yes, just about any ‘map()’ operation has a corresponding list > > > comprehension. (Does anyone know of a counter-example, a ‘map()’ > > > operation that doesn't have a correspondingly simple list > > > comprehension?) > > > Tr

Re: How to avoid certain directories when using os.walk?

2009-10-30 Thread Sean DiZazzo
On Oct 29, 10:17 pm, Chris Rebert wrote: > On Thu, Oct 29, 2009 at 9:53 PM, Peng Yu wrote: > > I don't see a way to avoid walking over directories of certain names > > with os.walk. For example, I don't want os.walk return files whose > > path include '/backup/'. Is there a way to do so? Otherwis

Re: ImportError: No module named _md5 - Please help

2009-10-29 Thread Sean DiZazzo
On Oct 29, 8:49 am, wadi wadi wrote: > I can't alter the import statement as the error log is pointing to one > of the installed python files 'hashlib.py' > > /python/2.6.2/lib/python2.6/hashlib.py > > and I don't have the right permissions to alter the python installation. > Any idea? > > On 10/2

Re: popen function of os and subprocess modules

2009-10-28 Thread Sean DiZazzo
On Oct 28, 7:15 am, banu wrote: > On Oct 28, 3:02 pm, Jon Clements wrote: > > > > > On 28 Oct, 13:39, banu wrote: > > > > Hi, > > > I am a novice in python. I was trying to write a simple script on > > > Linux (python 3.0) that does the following > > > > #cd directory > > > #ls -l > > > > I use

Re: Pause a thread/ execfile()

2009-10-26 Thread Sean DiZazzo
On Oct 26, 1:25 am, Babloo wrote: > On Oct 26, 1:01 pm, Sean DiZazzo wrote: > > > > > On Oct 25, 11:58 pm, Babloo wrote: > > > > i have a small python application with GUI (frontend) which has > > > various functions. I have a "RUN" button which

Re: Pause a thread/ execfile()

2009-10-26 Thread Sean DiZazzo
On Oct 25, 11:58 pm, Babloo wrote: > i have a small python application with GUI (frontend) which has > various functions. I have a "RUN" button which runs python scripts in > the background . It basically calls execfile() function internally > which runs in a thread ,  to run the python script . >

Re: ftplib connection fails with multiple nics

2009-10-20 Thread Sean DiZazzo
On Oct 19, 10:23 pm, Tim Roberts wrote: > Sean DiZazzo wrote: > > >I'm trying to connect to an ftp site from a windows machine with two > >nics going to two different networks, but I keep getting the below > >exception: > > >Traceback (most recent call l

Re: ftplib connection fails with multiple nics

2009-10-20 Thread Sean DiZazzo
On Oct 19, 10:23 pm, Tim Roberts wrote: > Sean DiZazzo wrote: > > >I'm trying to connect to an ftp site from a windows machine with two > >nics going to two different networks, but I keep getting the below > >exception: > > >Traceback (most recent call l

Re: ftplib connection fails with multiple nics

2009-10-17 Thread Sean DiZazzo
On Oct 16, 4:51 pm, Sean DiZazzo wrote: > Hi all, > > I'm trying to connect to an ftp site from a windows machine with two > nics going to two different networks, but I keep getting the below > exception: > > Traceback (most recent call last): >   File "ftp.

ftplib connection fails with multiple nics

2009-10-16 Thread Sean DiZazzo
Hi all, I'm trying to connect to an ftp site from a windows machine with two nics going to two different networks, but I keep getting the below exception: Traceback (most recent call last): File "ftp.pyo", line 70, in connect File "ftp.pyo", line 17, in __init__ File "ftplib.pyo", line 131,

Re: the usage of 'yield' keyword

2009-10-15 Thread Sean DiZazzo
On Oct 15, 9:48 pm, Sean DiZazzo wrote: > On Oct 13, 6:41 pm, Peng Yu wrote: > > >http://docs.python.org/reference/simple_stmts.html#grammar-token-yiel... > > > The explanation of yield is not clear to me, as I don't know what a > > generator is. I see the follow

Re: the usage of 'yield' keyword

2009-10-15 Thread Sean DiZazzo
On Oct 13, 6:41 pm, Peng Yu wrote: > http://docs.python.org/reference/simple_stmts.html#grammar-token-yiel... > > The explanation of yield is not clear to me, as I don't know what a > generator is. I see the following example using 'yield'. Could > somebody explain how 'yield' works in this exampl

Re: "Pipeline" Generator presentation - where?

2009-09-28 Thread Sean DiZazzo
On Sep 28, 9:12 pm, alex23 wrote: > Sean DiZazzo wrote: > > I remember reading (a few times) a presentation about using generators > > to create "pipelines"  The idea was to create very specific and small > > generator functions, and then combine them together

Re: How to jump out of nested 'for'-loops?

2009-09-28 Thread Sean DiZazzo
On Sep 28, 8:09 pm, Peng Yu wrote: > Hi, > > I want some command to jump out of nested loop. I'm wondering what is > the most convenient way to do so in python. > > for i in range(10): >   print "i = ", i >   for j in range(10): >     if i*10 + j == 50: >       print i*10 + j >       break # I wan

"Pipeline" Generator presentation - where?

2009-09-28 Thread Sean DiZazzo
I remember reading (a few times) a presentation about using generators to create "pipelines" The idea was to create very specific and small generator functions, and then combine them together to get larger results. The example used was to parse log files contained in gzipped log files among other

Re: Catch script hangs

2009-09-27 Thread Sean DiZazzo
On Sep 27, 3:40 pm, Bakes wrote: > Due to an ftp server issue, my python script sometimes hangs whilst > downloading, unable to receive any more data. Is there any way that I > could have python check, maybe through a thread or something, whether > it has hanged (or just, if it's still active afte

Re: Poll: Do you use csv.Sniffer?

2009-09-24 Thread Sean DiZazzo
On Sep 24, 7:26 pm, s...@pobox.com wrote: > If you are a csv module user, I have a question for you:  Do you use the > csv.Sniffer class? > >     o Yes, frequently >     o Yes, on occasion >     o I tried it a few times but don't use it now >     o No, I don't need it >     o No, never heard of it

Re: PExpect on Windows System Using Cygwin

2009-09-24 Thread Sean DiZazzo
On Sep 24, 4:37 pm, Dave Angel wrote: > Kevin Holleran wrote: > > Hello, > > > I downloaded and installed the pexpect module and wrote a script.  All is > > well and good, but the script proved to be pretty useful and now I was asked > > to run it as a scheduled task up on a server to run periodic

Re: Date using input

2009-09-24 Thread Sean DiZazzo
On Sep 24, 7:49 am, flebber wrote: > On Sep 24, 11:10 pm, flebber wrote: > > > > > On Sep 24, 10:58 pm, Dave Angel wrote: > > > > flebber.c...@gmail.com wrote: > > > > I am using python 2.6.2, I haven't updated to 3.0 yet. No I have no > > > > class or instructor, I am learning this myself. I ha

Re: Searching a large dictionary

2009-09-23 Thread Sean DiZazzo
On Sep 23, 4:05 pm, "Rhodri James" wrote: > On Wed, 23 Sep 2009 22:52:56 +0100, mike171562   > > wrote: > > Sorry for the confusion, Simon, this is almost exactly what I need, > > but i need to be able to search for a string in a given value of an > > item > > > Here is an example of the dict I a

Re: Open file on remote linux server

2009-09-23 Thread Sean DiZazzo
On Sep 23, 12:04 pm, The Bear wrote: > Hi I'm looking to do something like this > > f = f.openfileobj(remotefileloc, localfilelikeobj) > > my remote files are on a solaris box that i can access using ssh (could > prehap request othe protocols if necessary) > > anyone got any ideas? > > many thanks

Re: custom data warehouse in python vs. out-of-the-box ETL tool

2009-09-22 Thread Sean DiZazzo
On Sep 22, 1:00 pm, snfctech wrote: > Does anyone have experience building a data warehouse in python?  Any > thoughts on custom vs using an out-of-the-box product like Talend or > Informatica? > > I have an integrated system Dashboard project that I was going to > build using cross-vendor joins o

Re: How can I tell if variable is defined

2009-09-22 Thread Sean DiZazzo
On Sep 22, 11:03 am, "Brown, Rodrick " wrote: > How could I do the following check in Python > > In Perl I could do something like if ((defined($a)) { ... } > > I tried if var is not None: > However this doesn't seem to work as described. > > Thanks. try: var except NameError: handle_it()

Re: using python 2.5

2009-09-21 Thread Sean DiZazzo
On Sep 21, 4:42 pm, "kunal.k" wrote: > I have installed python 2.5 for a particular code. Now i have 2.6 > already installed. How do i direct this code to use the 2.5 modules?? I don't think you do. You should install the modules for python 2.6. You could try to hand copy the modules, and some m

Re: easy question, how to double a variable

2009-09-21 Thread Sean DiZazzo
On Sep 21, 1:46 pm, daggerdvm wrote: > u don't want to answerthen why post?...get lost. I eat children... -- http://mail.python.org/mailman/listinfo/python-list

Re: control CPU usage

2009-09-19 Thread Sean DiZazzo
On Sep 19, 9:17 am, kakarukeys wrote: > Hi, > > When I am running a loop for a long time, calculating heavily, the CPU > usage > is at 100%, making the comp not so responsive. Is there a way to > control the > CPU usage at say 80%? putting a time.sleep(0.x) doesn't seem to help > although CPU usag

Re: Granularity of OSError

2009-09-18 Thread Sean DiZazzo
On Sep 18, 5:23 pm, Christian Heimes wrote: > kj wrote: > > For example, LBYL would look like this: > > > if os.path.isfile(some_file): > >     os.unlink(some_file) > > > In contrast, EAFP would look like this: > > > try: > >     os.unlink(some_file) > > except OSError: > >     pass > > The two ve

Re: Creating a local variable scope.

2009-09-18 Thread Sean DiZazzo
On Sep 11, 10:36 am, Johan Grönqvist wrote: > Hi All, > > I find several places in my code where I would like to have a variable > scope that is smaller than the enclosing function/class/module definition. > > One representative example would look like: > > -- > spam = { ... } > eggs = { .

Re: Why use "locals()"

2009-09-18 Thread Sean DiZazzo
On Sep 18, 9:55 am, Simon Forman wrote: > On Mon, Sep 14, 2009 at 1:12 AM, Sean DiZazzo wrote: > > > Thanks for your explanation Steven.  I see how it can be valuable, but > > it seems to always break the second rule of Zen.  I don't really want > > to get into the c

Re: Granularity of OSError

2009-09-18 Thread Sean DiZazzo
On Sep 18, 11:54 am, kj wrote: > I've often come across the idea that good Python style deals with > potential errors using an EAFP ("easier to ask forgiveness than > permission") strategy rather than a LBYL ("look before you leap") > strategy. > > For example, LBYL would look like this: > > if os

Re: overrideredirect vs. text entry etc. widget

2009-09-16 Thread Sean DiZazzo
On Sep 15, 10:20 pm, kernus wrote: > On Sep 15, 11:42 am, Sean DiZazzo wrote: > > > > > Whats interesting is that if you call overrideredirect from a button > > command, it works as expected.  Well, at least the text entry field > > ^so, Sean, you

Re: overrideredirect vs. text entry etc. widget

2009-09-15 Thread Sean DiZazzo
On Sep 14, 10:43 pm, kernus wrote: > I just googled this post: > > http://mail.python.org/pipermail/python-list/2006-September/575832.html > > something like: > > from Tkinter import * > > root = Tk() > Entry(root).pack() > Button(root, text='Quit', command=sys.exit).pack() > root.overrideredirect

Re: Why use "locals()"

2009-09-13 Thread Sean DiZazzo
> If you are willing to open your mind to the possibility that some > Pythonic things don't adhere to every Zen, then I would suggest that > Gabrielle's examples are perfectly Pythonic shortcuts.  But if you > don't want to use them, you don't have to, nobody is forcing you. It's a pretty small do

Re: Why use "locals()"

2009-09-13 Thread Sean DiZazzo
On Sep 13, 9:11 pm, Steven D'Aprano wrote: > On Sun, 13 Sep 2009 20:26:06 -0700, Sean DiZazzo wrote: > > On Sep 13, 8:18 pm, Steven D'Aprano > > wrote: > >> On Sun, 13 Sep 2009 20:06:51 -0700, Sean DiZazzo wrote: > >> > I have never used a cal

Re: Why use "locals()"

2009-09-13 Thread Sean DiZazzo
> > I have never used a call to "locals()" in my code.  Can you show me a > > use case where it is valuable and Pythonic? > > def print_item(item): >      description = textwrap.fill(item.description, 40) >      short = item.description.split('\n', 1)[0] >      code = str(item.id).zfill(6) >      p

Re: Why use "locals()"

2009-09-13 Thread Sean DiZazzo
On Sep 13, 8:18 pm, Steven D'Aprano wrote: > On Sun, 13 Sep 2009 20:06:51 -0700, Sean DiZazzo wrote: > > I have never used a call to "locals()" in my code.  Can you show me a > > use case where it is valuable and Pythonic? > > grep is your friend: > >

Why use "locals()"

2009-09-13 Thread Sean DiZazzo
I have never used a call to "locals()" in my code. Can you show me a use case where it is valuable and Pythonic? ~Sean -- http://mail.python.org/mailman/listinfo/python-list

Re: NameError: name '__main__' is not defined

2009-09-13 Thread Sean DiZazzo
On Sep 13, 6:43 pm, Peng Yu wrote: > Hi, > > I try the following code. I don't quite understand why __main__ is not > defined. Could somebody let me know what I am wrong about it? > > Regards, > Peng > > $ cat test.py > #!/usr/bin/env python > > if __main__ == '__main__' : >   print "Hello World!\

Re: NameError: name '__main__' is not defined

2009-09-13 Thread Sean DiZazzo
On Sep 13, 6:43 pm, Peng Yu wrote: > Hi, > > I try the following code. I don't quite understand why __main__ is not > defined. Could somebody let me know what I am wrong about it? > > Regards, > Peng > > $ cat test.py > #!/usr/bin/env python > > if __main__ == '__main__' : >   print "Hello World!\

Re: run exe on different computer

2009-09-13 Thread Sean DiZazzo
On Sep 13, 4:57 pm, Dave Angel wrote: > daved170 wrote: > > On Sep 13, 2:17 pm, Dave Angel wrote: > > >> daved170 wrote: > > >>> Hi everybody, > >>> I'm building a small python program that run a service (exe file) on > >>> my servers. > >>> I don't want to use remote desktop and it's siblings. >

Re: Why indentation is use to denote block of code?

2009-09-13 Thread Sean DiZazzo
On Sep 13, 3:12 pm, Peng Yu wrote: > Hi, > > I want to understand why python use indentation to denote block of > code. What are the advantages of it? Is there a style in python to > denote a block of code the same as that of C++ (with '{}')? > > One disadvantage of using indentation to denote a b

Re: Why indentation is use to denote block of code?

2009-09-13 Thread Sean DiZazzo
On Sep 13, 3:12 pm, Peng Yu wrote: > Hi, > > I want to understand why python use indentation to denote block of > code. What are the advantages of it? Is there a style in python to > denote a block of code the same as that of C++ (with '{}')? > > One disadvantage of using indentation to denote a b

  1   2   >