setup.py, how to find main program/module?

2018-12-18 Thread ant
tra-index-url https://pypi.org/simple ngfp==0.1.5.post3 thank you and cheers, ant -- https://mail.python.org/mailman/listinfo/python-list

Re: setup.py, how to find main program/module?

2018-12-19 Thread ant
dieter wrote: > ant writes: >> ... >> yet not quite all the way yet. i run the >> commands to make the sdist and wheels and upload >> it using twine to my test account, but when >> i install it and try to run it the ngfp.py is >> not found (i'

ah, progress...

2018-12-19 Thread ant
ant wrote: ... script was there, but the package was not actually installed. after installing again i get: = (env) me@ant(26)~/src/test$ ngfp Traceback (most recent call last): File "/home/me/src/env/bin/ngfp", line 7, in from ngfp import main ImportError: cannot i

Re: ah, progress...

2018-12-19 Thread ant
ant wrote: > ant wrote: > > ... > > script was there, but the package was not actually > installed. > > after installing again i get: > >= > > (env) me@ant(26)~/src/test$ ngfp > Traceback (most recent call last): > File "/home/me/src/env/bin

Re: ah, progress...

2018-12-20 Thread ant
dieter wrote: > ant writes: >> ant wrote: >> ... >>> (env) me@ant(26)~/src/test$ ngfp >>> Traceback (most recent call last): >>> File "/home/me/src/env/bin/ngfp", line 7, in >>> from ngfp import main >>> ImportError:

Re: Mask two images with python

2018-12-21 Thread ant
e to take the code and use it however you like: https://salsa.debian.org/ant-guest/gfpoken-in-python ant -- https://mail.python.org/mailman/listinfo/python-list

Re: ah, progress...

2018-12-21 Thread ant
dieter wrote: > ant writes: >> ... >> in order to get this far below i had to edit each >> file and put a try: except: around each import >> statment checking if the module could be found >> like (as an example): >> >> try: >> import config

[SOLVED] Re: ah, progress...

2018-12-23 Thread ant
dieter wrote: ... thank you for your help. :) i finally worked through the changes needed at last. my current package in testing PyPI is at: https://test.pypi.org/project/ngfp/ which uses my code from: https://salsa.debian.org/ant-guest/gfpoken-in-python i ended up needing

Re: Why am I getting Error 405 while uploading my package to https://test.pypi.org/legacy?

2018-12-23 Thread ant
cd $NGFP_SRC_HOME twine upload --repository testpypi dist/* = note: it may take a while for what you uploaded to be made available for download again even if it reflected in your project page. sometimes it has been as long as a half hour or more before it comes down. other times it has only been a few minutes. hope this helps... ant -- https://mail.python.org/mailman/listinfo/python-list

Re: Why am I getting Error 405 while uploading my package to https://test.pypi.org/legacy?

2018-12-23 Thread ant
ant wrote: ... > .pypirc >= > [distutils] > index-servers= > testpypi > > [testpypi] > repository: https://test.pypi.org/legacy/ > username: UserName > password: Password >= > > > and my upload command is: > > >= > #!/bin

Re: Why am I getting Error 405 while uploading my package to https://test.pypi.org/legacy?

2018-12-23 Thread ant
rsions of setuptools, wheel and twine $ pip install --upgrade setuptools $ pip install --upgrade wheel $ pip install --upgrade twine i just used it earlier today... worked fine for me. is your account there and verified? ant -- https://mail.python.org/mailman/listinfo/python-list

Re: Why am I getting Error 405 while uploading my package to https://test.pypi.org/legacy?

2018-12-23 Thread ant
>> i just used it earlier today... worked fine for me. >> is your account there and verified? > > Yes, I have an account on TestPyPI and is verified. try the above... ant -- https://mail.python.org/mailman/listinfo/python-list

Re: Why am I getting Error 405 while uploading my package to https://test.pypi.org/legacy?

2018-12-24 Thread ant
sntshkm...@gmail.com wrote: >> $ pip install readme_renderer[md] > > Thanks a lot for this, I wasn't able to figure it out earlier. does it work ok now? got the upload to go to pypitest? ant -- https://mail.python.org/mailman/listinfo/python-list

next steps to make a python program more available

2018-12-27 Thread ant
: 1. posix/other linux sytems (perhaps Macs fit into this anways) 2. Macs 3. Windows luckily i do have other examples of python 3 programs which seem to be multiple platform oriented that i can look at and see what they've done. so i won't be forever lost in the wilderness

Re: advice needed for simple python web app

2005-02-04 Thread Ant
> You might also look at the docs for HTML::Mason (www.masonhq.com) to > get a look at a reasonably mature template system, even if you don't > plan to use it (because it's in Perl and not Python). I'm not sure if > CherryPy is directly comparable. I haven't yet used any of the Python > template

Re: Abuse of the object-nature of functions?

2006-07-11 Thread Ant
> Is there a way in python to say, "hey, catch everything but these two"? >>> try: ... raise AttributeError ... except Exception, ex: ... if isinstance(ex, AttributeError): ... print "Won't catch it!" ... raise ex ... Won't catch it! Traceback (most recent call last): File "", line

Re: hash of hashes

2006-07-11 Thread Ant
sfo wrote: > how do i create a hash of hash similar to perl using dict in python > $x{$y}{z}=$z Haven't done any Perl in a long while (thankfully ;-) ) so I'm not quite sure on your syntax there, but here's how to do it in Python: >>> x = {'y': {'z': 'My value'}} >>> x['y']['z'] 'My value' Much

Re: Abuse of the object-nature of functions?

2006-07-11 Thread Ant
> > try: > > # Do some stuff > > except Exception, err: > > if err not in (DontCatchMe1, DontCatchMe2): > > # Handle err > > > > HTH, > > ~Simon > > Dang! not only did somebody else beat me to it, but my code is wrong > and theirs correct. Ignoring the fact you haven't re-raised

Re: How to display name of elements in list?

2006-07-12 Thread Ant
> I'm using a badly documented module and therefore need to find out > about how to access the elements in a list. > (I need to do this in Python 1.5.3) I presume this is the same in 1.5 use dir(): >>> import os >>> dir(os) ['F_OK', 'O_APPEND', 'O_BINARY', 'O_CREAT', 'O_EXCL', 'O_NOINHERIT', 'O_

Re: Accessors in Python (getters and setters)

2006-07-12 Thread Ant
> Yes, it is possible to name crappy accessors too (e.g set_tmp/get_tmp). > But developers tend to pay more attention to given methods/functions > less crappy names, at least when compared to data attributes. This In my experience of getters and setters in Java, most developers choose attribute n

Re: testing array of logicals

2006-07-12 Thread Ant
John Henry wrote: > Hi list, > > Is there a more elagant way of doing this? > > # logflags is an array of logicals > test=True > for x in logflags: >test = test and x > print test There's reduce, but it's not as explicit, and see F's post RE efficiency: >>> x = [True, True, True] >>> y = [Tr

Re: Accessors in Python (getters and setters)

2006-07-13 Thread Ant
We seem to be flogging a dead horse now. Is the following a fair summary: Q. What is the Pythonic way of implementing getters and setters? A. Use attributes. Quote: "I put a lot more effort into choosing method and function names" Wisdom: Python is a different paradigm from (e.g.) Java w.r.t. a

Re: Regular Expression problem

2006-07-13 Thread Ant
> So What should I do to get the exact value(here the value after > 'href=') in any case even if the > > tags are like these? >> > > > -OR- > > -OR- > The following should do it: expr = r'http://mail.python.org/mailman/listinfo/python-list

Re: Coding style

2006-07-19 Thread Ant
Christophe wrote: > ... you haven't beed using enouth generator expressions ... You should get yourself to the doctors about that cold dude. :-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Simple file writing techiques ...

2006-07-19 Thread Ant
> fout = open('somefile','w') > for line in convertedData: > fout.write("%s\n" % line) > fout.close() > > -- or -- > > fout = open('somefile','w') > fout.write("%s" % '\n'.join(convertedData)) > fout.close() I shouldn't think it matters too much which of these you use - time them and see what h

Re: Simple file writing techiques ...

2006-07-19 Thread Ant
Whoops: > outfile = open(out_f) outfile = open(out_f, 'w') may be better ;-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Accessors in Python (getters and setters)

2006-07-19 Thread Ant
Ed Jensen wrote: > > where the compiler prevents you from accessing > > private variables, but the runtime allows access to these very variables > > via reflection? > > Java does not allow access to private members via reflection. Yes it does. You can call setAccessible(true) on the Method objec

Re: Accessors in Python (getters and setters)

2006-07-20 Thread Ant
Came across this article this afternoon - thought it may be of interest to some of those following this thread... http://www.devx.com/opensource/Article/31593/0/page/2 -- http://mail.python.org/mailman/listinfo/python-list

Re: Since there was talk of if-then-else not being allowed in lambda expressions, the following is from "Dive into Python"

2006-07-21 Thread Ant
> # python 2.5 > >>> a, b = "", 0 > >>> a if False else b > 0 > >>> a if True else b > '' > > Time to tear out that page. Really. Not quite - 2.5 hasn't been released in its final version yet, and many projects I should imagine will take a while to upgrade. -- http://mail.python.org/mailman/lis

Re: Smaple of recursive directory walker

2006-07-29 Thread Ant
> At work I have a directory of about 50 large text files and i need to > search thru them for 10 separate words and print how many were found > in total. > > I am new to python so could somebody please show me some sample code > that would help me get this done and i will work from that. Assumin

Re: Smaple of recursive directory walker

2006-07-30 Thread Ant
Traveler wrote: > yes this is great i will work from that but how can i use say a list > to pass 10 words? > > mylist = ['word1','word2','word3','word4'] ... > >for root, dirs, files in os.walk('~/mydir'): > >for file in [f for f in files if f.endswith(".txt")]: > >fh = open(file) > >

Re: Zipping files/zipfile module

2006-08-02 Thread Ant
Enabling directory recursion: > from os import listdir, mkdir > from os.path import join, basename, isfile > from zipfile import ZipFile > > def zip_dir(path, output_path, include_hidden=True): > try: > mkdir(output_path) > except OSError, e: > if e.errno == 17: # Path exis

Re: looking for a regular expression

2006-08-02 Thread Ant
> But what if there's not only commas, but also periods and semicolons? I > want to find words between 2 near by punctuations. I think it would make > it difficult to use split instead of regular expression. You could use re.split(r"\W", text) instead of the string split method to split on all non

Re: need help of regular expression genius

2006-08-02 Thread Ant
GHUM wrote: > I need to split a text at every ; (Semikolon), but not at semikolons > which are "escaped" within a pair of $$ or $_$ signs. Looking at you example SQL code, it probably isn't possible with regexes. Consider the code: $$ blah blah ... $$ blah; xxx $$ blah blah $$ Regexes aren't c

Re: Python Projects Continuous Integration

2006-08-07 Thread Ant
Harry George wrote: > [snip stuff about how to set emacs up as your IDE] Not sure which post you read, but the OP of this thread was asking about continuous integration, not integrated development environments. i.e. tools to *automatically* check out code when the repository has changed, build it

Re: How to get hours and minutes from 'datetime.timedelta' object?

2006-08-07 Thread Ant
John Machin wrote: > Lad wrote: > > Hello, > > what is the best /easest way how to get number of hours and minutes > > from a timedelta object? ... > >>> diff.days > 0 > >>> diff.seconds > 52662 > >>> diff.microseconds > 922000 > >>> minutes = (diff.seconds + diff.microseconds / 100.0) / 60.0

Re: How to get hours and minutes from 'datetime.timedelta' object?

2006-08-07 Thread Ant
John Machin wrote: ... > 1. If that's what he wanted, it was a very peculiar way of asking. Do > you suspect that he needs to be shown how to conver 877.7... minutes > into hours, minutes and seconds??? Chill dude, It wasn't an attack :-) The datetime class has hour, minute and second attributes

Re: is it possible to dividing up a class in multiple files?

2006-08-07 Thread Ant
Martin Höfling wrote: > Hi there, > > is it possible to put the methods of a class in different files? I just > want to order them and try to keep the files small. The editor leo (http://webpages.charter.net/edreamleo/front.html) gives you a way of handling large files in this way without actuall

Re: screensaver in Python

2006-08-07 Thread Ant
daniel Van der Borght wrote: > Programming a screensaver in Python, where and/or how di I start ? Google for "python screensaver". The first link has a module to use... -- http://mail.python.org/mailman/listinfo/python-list

Re: screensaver in Python

2006-08-07 Thread Ant
daniel Van der Borght wrote: > are you Chris ? anyway : thank you... No - I really am Ant. :-) -- http://mail.python.org/mailman/listinfo/python-list

Re: need an alternative to getattr()

2006-08-07 Thread Ant
> getattr(heading, "process")(file_ptr) ... > Is there an alternatice to getattr() that will solve my problem, or is > there another way to do it. How about: eval("%s.process(%s)" % (heading, file_ptr)) -- http://mail.python.org/mailman/listinfo/python-list

Re: Two Classes In Two Files

2006-08-10 Thread Ant
[EMAIL PROTECTED] wrote: > Yes, I have been ruined for the last 5 years with Java and C#. Perl was > my only salvation, but now I can't read the programs I wrote. ROFL! That's got to be a contender for Quote of the week. -- http://mail.python.org/mailman/listinfo/python-list

Re: keep a list of read and unread items

2006-08-13 Thread Ant
a wrote: > i m building an rss reader and i want you suggestions for datastructure > for keeping read and unread list for each use > i m assuming it will be very sparse A dictionary for each site seems to be the obvious choice, mapping the article ID to True or False. -- http://mail.python.org

Re: Memory usage of an 'empty' python interpreter

2006-08-16 Thread Ant
[EMAIL PROTECTED] wrote: > I was wondering what the approximate amount of memory needed to load a > Python interpreter (only, no objects, no scripts, no nothing else) in a > Linux 2.6 environment. According to ps, it appears to be 3312 bytes, > which seems absurdly low to me. However, when I che

Re: Memory usage of an 'empty' python interpreter

2006-08-16 Thread Ant
> > Are you sure ps is reporting in bytes not KB? The bare interpreter in > > Windows is 3368KB. > > Where did you get that from? With Python 2.4.3, on my machine (Win XP > SP2): > > C:\junk>dir \python24\python* > [snip] > 29/03/2006 05:35 PM 4,608 python.exe > 29/03/2006 05:35 PM

Re: trouble understanding inheritance...

2006-08-17 Thread Ant
Try running the following example - it should help clear up what is going on: class Base: def __init__(self): print "Initializing base" def shouldBeImplemented(self): raise NotImplementedError def hasDefaultImplementation(self): print "Wey Hey!" class A(Base):

Re: text editor suggestion?

2006-08-18 Thread Ant
John Salerno wrote: > I'd really like to learn vim, but I spent days just trying to figure out > how to get the syntax highlighting and indentation working, where these > settings are and how to edit them, and it still doesn't work for me. It > just feels so insurmountable that I can't even start

Re: trouble using "\" as a string

2006-08-20 Thread Ant
> such as tempname="\"..it says that the line is single qouted. The others have addressed the escape issue I think. However it looks like you want the funtionality of the os.path module. For example: >>> import os.path as path >>> filename = "/home/ant/te

Bug in re module?

2006-10-06 Thread Ant
Look at the following minimal example: >>> import re >>> p = re.compile(r"(:?Test) (String)") >>> m = p.search("This is a Test String OK?") >>> m.groups() ('Test', 'String') I would have expected this to produce: ('String') since (:?...) should be a non-capturing group. From the module referenc

Re: Bug in re module?

2006-10-06 Thread Ant
Ant wrote: > Look at the following minimal example: ... (snip example that shows non-capturing group capturing) Note I get the same results from python versions 2.4 and 2.5. -- http://mail.python.org/mailman/listinfo/python-list

Re: Bug in re module?

2006-10-06 Thread Ant
Just wrote: > Try ?: instead of :? Duh. Put it down to Friday afternoon! :-\ Don't know what I was thinking that something as high profile as that could slip through the net!! -- http://mail.python.org/mailman/listinfo/python-list

Re: Bug in re module?

2006-10-06 Thread Ant
John Machin wrote: > Now quick kill your post before the effbot spots it :-) Too late - the post was 3 minutes ago you know ;-) -- http://mail.python.org/mailman/listinfo/python-list

Re: humble coin head or tail game script I wrote

2006-10-07 Thread Ant
> # Get a list which contains 10 values from the user > # let them predict Head Or Tail in ten times coin thrown > # and then prdict the list by a fixed rule > > > list = [] > > print 'Predict Head or Tail in ten times coin thrown\nJust input \'h\' > or \'t\' please\n' > > count = 0 > while True:

Re: Is there an alternative to os.walk?

2006-10-07 Thread Ant
The idiomatic way of doing the tree traversal is: def search(a_dir): valid_dirs = [] for dirpath, dirnames, filenames in os.walk(a_dir): if dirtest(filenames): valid_dirs.append(dirpath) return valid_dirs Also since you are given a list of filenames in the directory, th

Re: recommendations for personal journaling application

2006-10-08 Thread Ant
Donnie Rhodes wrote: ... > > Thank you all and I hope I'm not biting off too much at once... Not if you break it up into pieces. Look at the things you want to do, and in the first instance, create a function for each. Then you can start to fill in the blanks, and if neccessary ask back here for

Re: OT: Sarcasm and irony

2006-10-11 Thread Ant
Brian van den Broek wrote: ... > A quick check with the on-line text of the second edition of the > Oxford English Dictionary (sadly, a link only available by > subscription) gives as the first meaning: If we're going to start using dictionary definitions, then I claim that the following joke is

Re: Converting MSWord Docs to PDF

2006-10-11 Thread Ant
Theerasak Photha wrote: > On 10/11/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: ... > (La)TeX is the king of document processing, and does PDF. Except that the OP want's to print Word documents as PDF. LaTeX is good, granted, but just try converting LaTeX documents to Word or vice versa... A

Re: a little about regex

2006-10-18 Thread Ant
Rob Wolfe wrote: ... > def filter(adr):# note that "filter" is a builtin function also > import re > > allow = re.compile(r'.*(?|$)') # negative lookbehind > deny = re.compile(r'.*\.com\.my(>|$)') > cnt = 0 > if deny.search(adr): cnt += 1 > if allow.search(adr): cnt +=

Re: I like python.

2006-10-20 Thread Ant
Fidel wrote: > Renaming the file doesn't work. I am on windows... There is a specific > line of code that tells python not to bother even opening a window. Seriously, renaming the script to .pyw should work from a standard python install. If it doesn't then the file handler for that extension mus

Re: FOR statement

2006-10-21 Thread Ant
Jordan Greenberg wrote: ... > >>> def printreverse(lst): > if lst: > printreverse(lst[1:]) > print lst[:1][0] Convoluted way of writing "print lst[0]" ! > >>> printreverse([1,2,3,4]) > > No good reason at all to do it this way. But recursion is fun. But there's

Re: sending vim text through Python filter

2006-10-23 Thread Ant
BartlebyScrivener wrote: > Hello, > > I'm sure this is my fault or some Windows snafu. But using gvim 7.0 on It's a bug in Windows. Try doing "sort.py < test.txt" from the command line, and you'll get the same error. Try "python sort.py < test.txt" and it should work fine. Apparently cmd.exe can'

Re: Using Python scripts in Windows Explorer

2006-10-23 Thread Ant
Ben Sizer wrote: > > Create a shortcut and drop the file over it. ... > That is what I meant by 'the usual steps'. :) It doesn't work. Alter the target of the shortcut to something like: C:\Python25\python.exe C:\0\sort_test.py and drag and drop should work, with the filename of the dragged fi

Re: The Python Journal

2006-11-02 Thread Ant
[EMAIL PROTECTED] wrote: ... > We'd love it if you could have a look at our first issue, and let us > know what you think! On the layout of the site: 1) I have to hit two separate Download buttons to get the PDF, and then the PDF must be viewed in an external reader rather than the browser plugi

Re: creating new objects with references to them

2006-11-02 Thread Ant
On Nov 2, 3:15 pm, "JohnJSal" <[EMAIL PROTECTED]> wrote: > It seems like what I want to do is something that programmers deal with > everyday, but I just can't think of a way to do it. Basically, I am > writing a DB front-end and I want a new "Researcher" object to be > created whenever the user

Problem exiting application in Windows Console.

2006-11-08 Thread Ant
Hi all, I'm putting together a simple help module for my applications, using html files stored in the application directory somewhere. Basically it sets up a basic web server, and then uses the webbrowser module to display it in the users browser. I have it set up to call sys.exit(0) if the url qu

Re: Need help

2006-11-08 Thread Ant
Srinivasa wrote: > Hai friends, > I wrote a programme to display a window (ui) using Python. I renamed it > as .pyw to avoid popping-up the dos window while running it. It worked > fine. But when i converted it to executable file using py2exe; the dos > window appears. Can anybody tell me what th

Exception Handling in TCPServer (was; Problem exiting application in Windows Console.)

2006-11-08 Thread Ant
Ant wrote: ... > However, at this point instead of getting back to a command prompt, I > get an unresponsive console. Hitting CTRL-Break gets me the command > prompt back, but I would have expected to get back the command prompt > as soon as the sys.exit(0) had completed.

Re: Exception Handling in TCPServer (was; Problem exiting application in Windows Console.)

2006-11-08 Thread Ant
Ant wrote: ... > OK, I've narrowed the problem back to the way HTTPServer (actually its > TCPServer parent) handles exceptions thrown by the process_request > method by catching them all, and then calling a handle_error method. > There doesn't seem to be a way of getting a

Re: Exception Handling in TCPServer (was; Problem exiting application in Windows Console.)

2006-11-09 Thread Ant
Steve Holden wrote: ... > First of all, five hour response time is a high expectation, you must be > a Platinum customer :-) I'm in the last week of my current job - start a new one on Monday, and so I haven't got a great deal to do at the moment. Five hours is a lifetime when you're staring at a

Re: Can not download plugins for jEdit (help!!)

2006-11-09 Thread Ant
On Nov 9, 6:52 am, "BillJosephson" <[EMAIL PROTECTED]> wrote: ... > If anyone knows why i can't connect, in info about it would be > a big help. Sounds like the default mirror is down. Go to Utilities -> Global Options -> Plugin Manager and click on "Update mirror list". Choose a new mirror and

Re: Can not download plugins for jEdit (help!!)

2006-11-09 Thread Ant
> Vim, it can handle all the things.http://www.vim.org/ I'm not convinced of that quite yet. jEdit's syntax highlighting seems more robust (see SocketServer.py in the standard library for an example - vim gets the highlighting of the first doc-comment wrong). I've also not found anything like jEdi

Re: Can not download plugins for jEdit (help!!)

2006-11-09 Thread Ant
On Nov 9, 2:11 pm, Neil Cerutti <[EMAIL PROTECTED]> wrote: ... > """ never are. Then I changed the synchronize declarations in > /syntax/python.vim to the following: > > syn sync match pythonSync grouphere NONE '"""$' > syn sync maxlines=300 > > The above is no good for random Python code, th

Re: Question regarding lists and regex

2006-11-09 Thread Ant
On Nov 9, 6:29 am, Prabhu Gurumurthy <[EMAIL PROTECTED]> wrote: ... > regex: I presume this is rather a dumb question, anyways here it comes! as you > can see from my program, pattIp = r\d{1,3}\ etc, is there any other easy > way > to group the reptitions, instead of typing the same regex 4

Re: Can not download plugins for jEdit (help!!)

2006-11-09 Thread Ant
> May I ask another quetion? I don't want to mess with lots of plugins > at this point. What are the minimum plugins to get a typical looking > IDE with a code window and output window and that lets me set > breakpoints and step through code? The Console plugin is a must (I think it depends on th

Re: Can not download plugins for jEdit (help!!)

2006-11-09 Thread Ant
On Nov 9, 3:27 pm, John Salerno <[EMAIL PROTECTED]> wrote: > Ant wrote: > > I do use vim more than Python these daysWhat does that mean? Are you > > referring to all the setup involved with vim? Whoops! I mean I use vim more than jEdit these days! -- http://mail.python

Re: Newb: installing Jython on Windows XP ...

2006-11-10 Thread Ant
On 10 Nov, 10:29, Marcus Bajohr <[EMAIL PROTECTED]> wrote: > donkeyboy wrote: > > All, > > > I'm having issues installing Jython on Windows XP. I've looked on the ... > > Any help would be of great use!!! > Try it from cmd, not from the cygwin shell. > The environments differ ! Looking at the co

Selection in Tkinter Text widget.

2006-06-02 Thread Ant
hould - from what I have read in Frederik's Intro to Tkinter guide - select all of the text in the text area. It doesn't however... Does anyone have any idea how to get this to work? Or tell me what I am doing wrong. Cheers, -- Ant... -- http://mail.python.org/mailman/listinfo/python-list

Re: Selection in Tkinter Text widget.

2006-06-02 Thread Ant
selection is only shown if the widget has focus. I just tried adding another component to the test, and switching from widget to widget does indeed stop the selection showing! Cheers, -- Ant... -- http://mail.python.org/mailman/listinfo/python-list

Re: How do you practice Python?

2006-06-02 Thread Ant
> In our field, we don't always get to program in the language we'd like For sure! > to program. So... how do you practice Python in this case? Say you're > doing J2EE right now. How do you practice Python to keep your skills > sharp? Well, we have to use J2EE at work. I keep my Python skills go

Re: C# equivalent to range()

2006-06-06 Thread Ant
> That's because many of them have killfiled you. I actually wonder whether anyone does use killfiles. I just can''t imagine the sort of person who writes "plonk" or "welcome to my killfile" etc could bear to miss out on a reply to such a post in case there's more to get angry about! And people w

Re: XML, JSON, or what?

2006-06-08 Thread Ant
> to use? I could go back to XML, or I could switch to JSON - I have read I'd favour JSON if the data structures are simple personally. XML is comparatively speaking a pain to deal with, where with JSON you can simply eval() the data and you have a Python dictionary at your disposal. I recently u

Re: XML, JSON, or what?

2006-06-08 Thread Ant
> Yes, evaling JSON, or any other text coming from the web, is definitely > a bad idea. > > But there's no need for eval: there are safe JSON codecs for python, Fair enough. And I should imagine that the codecs are still much faster and easier to use than XML for the same purpose. For my purpose

Python Video processing.

2006-06-13 Thread Ant
Hi all, I have a specific task I want to automate - rotating a video file through 90 degrees. I've used the PIL library quite a bit to perform batch processing on images, and would like to do similar on video. Can anyone see a problem with the following: 1) Use pymedia to convert the video into

Re: Python Video processing.

2006-06-13 Thread Ant
> im = Image.fromstring("RGB", dd.size, dd.data) > > instead of doing that pygame.image call (not that the argument order is > different). > > for details, see the pygame tostring/fromstring docs, and the corresponding > PIL > methods: That's starting to look promising, yes - thanks! I'll gi

Is there a better way of accessing functions in a module?

2006-06-13 Thread Ant
I have the following code which works fine for running some tests defined within a module: def a_test(): print "Test A" def b_test(): print "Test B" if __name__ == "__main__": tests = ["%s()" % x for x in dir() if x.endswith("test")] for test in tests: eval(test) But th

Re: Is there a better way of accessing functions in a module?

2006-06-13 Thread Ant
Ant wrote: ... > But this feels like a hack... Is there a cleaner way for accessing the > functions of the current module similar to the __dict__ attribute of > classes? i.e. a way to access the local symbol table? Sorry - posted too soon. Found the globals() built-in...

Re: Regular Expression pattern group

2006-06-15 Thread Ant
> I am a fussy learner. Could someone explain to me why the following > inconsistency exists between methods? How can it be justified if it is > considered all right? It's the standard way of accessing groups from regex matches in pretty much all languages that support them. In most modern langua

Re: a good programming text editor (not IDE)

2006-06-15 Thread Ant
> I've tried a few others, like TextPad and Crimson, and right now I use > UltraEdit, which I love actually, except for minor issues here and > there. But it'd be nice to make the move, as much as possible, to free, > open-source, cross-platform software. Vim is great if you have a good memory...

urllib2 problem with ports.

2006-06-15 Thread Ant
Hi all, I have just moved to a new machine, and so have installed the latest version of Python (2.4.3 - previously I believe I was running 2.4.2). Unfortunately this seems to have broken urllib2... An app I wrote for testing our web application makes heavy use of urllib2 against the localhost, an

Re: a good programming text editor (not IDE)

2006-06-15 Thread Ant
John Salerno wrote: > Ant wrote: > > > jEdit is for me still the best text editor available. Very extensible > > with macros (which can be written in Jython with the appropriate plugin > > installed). > > I like the idea of being extensible, but of course I can onl

Re: a good programming text editor (not IDE)

2006-06-16 Thread Ant
John Salerno wrote: > Larry Bates wrote: > > > Nope, no Java knowledge necessary. Jython just compiles Python code > > to java bytecode instead of python bytecode. Once it is in java bytecode > > the JVM doesn't know where it came from. > > Well that's good to know. I guess there's not much of a

Re: urllib2 problem with ports.

2006-06-16 Thread Ant
Fredrik Lundh wrote: > check your proxy configuration. most likely, your new machine is set up > to route all requests via a remote proxy. Here's me looking like a fool :-) The parts of the machine (eg Firefox, GAIM etc) that I'd set up use a direct connection - it looks like the guy who'd had

Re: a good programming text editor (not IDE)

2006-06-16 Thread Ant
> > Vim is great if you have a good memory... Otherwise you end up trawling > > through the help to find out how to do stuff that would in another IDE > > be just a few menu clicks away. > > Mental memory (the painful kind of memory) rapidly turns into muscle > memory (the fun kind of memory) and

Re: Python is fun (useless social thread) ;-)

2006-06-16 Thread Ant
> No, I learned it because Perl was too dirty and Java to complicated. > Now it is part of my daily job. Ditto. I was fed up of writing, compiling and running a java application just in order to do a quick script. I'd used perl, but quite frankly perl's a ridiculous language. Ruby looked promising

Re: Extracting values from text file

2006-06-16 Thread Ant
> What I first though was if there was possible to make a filter such as: > > Apples (apples) > (ducks) Ducks > (butter) g butter Try something like: import re text = """> Some text that can span some lines. Apples 34 56 Ducks Some more text. """ filters = {"apples": re.compile(

Re: Simple script to make .png thumbnails from .zip archive...

2006-06-19 Thread Ant
Try adapting the other posters example with something like: import Image, StringIO zip=zipfile.ZipFile(inURL,mode="r") picture=zip.read("00.jpg") image = Image.open(StringIO(picture)) image.thumbnail ((128,128), Image.ANTIALIAS) image.save (file + '.thumb.png') I haven't tested it, but some

urllib2 OpenerDirector question on usage.

2006-06-21 Thread Ant
each hypothetical user will achieve this effect - i.e. sessions will be separate from each other in the app, since the openers will return different session cookies back to the server. Cheers, Ant... -- http://mail.python.org/mailman/listinfo/python-list

Re: Chapter 9 Tutorial for Classes Not Working

2006-06-30 Thread Ant
> class MyClass: > "A simple example class" > i = 12345 > def f(self): > return 'hello world' Nothing wrong with this. > From here I run: > x = MyClass Here's your problem - x is a class, *not* an instance of a class (i.e. an object). Methods operate on objects, not clas

Re: Easier way to save result of a function?

2006-07-05 Thread Ant
> Thanks, that's awesome! Definitely not something I'd have ever been able > to work out myself - I think I need to learn more about nested functions > and introspection. I've recently found nested functions incredibly useful in many places in my code, particularly as a way of producing functions

Re: eval to dict problems NEWB going crazy !

2006-07-07 Thread Ant
> [('recId', 3), ('parse', {'pos': u'np', 'gen': u'm'})] > [('recId', 5), ('parse', {'pos': u'np', 'gen': u'm'})] > # line injected by a malicious user > "__import__('os').system('echo if I were bad I could do worse')" > [('recId', 7 ), ('parse', {'pos': u'np', 'gen': u'm'})] I'm curious, if you

  1   2   3   4   >