Python Software Problems


When I try to initilialize the screen settings with:

(Toggle Plain Text) def video_settings(): pygame.init() pygame.display.set_caption('Soulodine v 0.2') screen = pygame.display.set_mode((800, 500)) pygame.mouse.set_visible(0) return screen screen = video_settings() def video_settings(): pygame.init() pygame.display.set_caption('Soulodine v 0.2') screen = pygame.display.set_mode((800, 500)) pygame.mouse.set_visible(0) return screen screen = video_settings()
Posted On: Friday 28th of December 2012 05:27:06 AM Total Views:  182
View Complete with Replies

RELATED TOPICS OF Python Programming PROGRAMMING LANGUAGE




storing pickles in sql data base

I need to store pickled objects in postgresql. I reading through the pickle docs it says to always open a file in binary mode because you can't be sure if the pickled data is binary or text. So I have 2 question. Can I set the pickle to be text -- and then store it in a 'text' type field in my sql table, or should what sql type should I save the pickle as -- David Bear -- let me buy your intellectual property, I want to own your thoughts --
VIEWS ON THIS POST

76

Posted on:

Monday 5th November 2012
View Replies!

Error from zipfile

Dear Users, I'm having a problem when trying to move script from Linux to Windows. A zipfile opperation is failing with the message: "BadZipFile: File is not a zip file" I have a simple scripts that reads a zip file in the same way as any other file into a string, then sends it across to a network where it is saved as perusual into a file, then read in and processed by zipfile. I've tried adding the flag to allow 64 bit and even using uncompressed zip files. Niether fixes the problem. The zip file and contents were created on linux. To be certain that was not the issue I have emptied the zip file, created a new one, opend all the files in wordpad and saved them, then put the contents into the new file. Still no joy. Any help would be greatly appreciated. On linux I'm running python 2.5 and on windows it is 2.4.
VIEWS ON THIS POST

71

Posted on:

Wednesday 7th November 2012
View Replies!

PyGtk Windows all in one installer

I realized a PyGtk all in one installer for Windows. You can download it from here: http://www.bonifazi.eu/appunti/pygtk..._installer.exe It is simply an assembling of all the different installers I previously downloaded (which are executed step by step), and you can choose. I realized this installer using EclipseNSIS and compiling the script generated by NSIS. Then, the script I created and that you can compile and modify using NSIS is the following: http://www.bonifazi.eu/appunti/pygtk..._installer.nsi I give also the link of the webpages where I got the different installers: http://www.bonifazi.eu/appunti/2008/...installer.html I'll try to keep update this installer. I hope it could be useful to someone. Bye. Marco Bonifazi
VIEWS ON THIS POST

58

Posted on:

Wednesday 7th November 2012
View Replies!

implementing tab completion using python

Hi. How can I implement a tab-completing code using Python Like for example, I want to design a simple shell (using Python, of course), which could support tab completion as well. How do I go about it
VIEWS ON THIS POST

97

Posted on:

Wednesday 7th November 2012
View Replies!

24 Hour Coding Contest AT BITS-Pilani in Association with Google

24 HOURS - NATIONWIDE ONLINE ALGORITHM INTENSIVE PROGRAAMING CHALLENGE Are you ready to tickle your grey cells with mind boggling algorithm intensive programming challenge that offers you freedom of programming in around 5 languages\t If yes, Watch out for 24 HOURS, the Nation wide Algorithm Intensive programming Contest brought to you by Computer Science Association (BITS Pilani) and GOOGLE India. 24 Hours is an online programming contest where in you will be provided with a real time programming problem from one of the most emerging arenas of computer science. You are required to design necessary algorithm to solve the problem, code it in any language of your choice - C,C++,JAVA,PYTHON OR RUBY!, with help of the API provided to you and submit your solutions within 24 hours from the commencement of the competition . This would be essentially a test for your endurance and efficiency in real-time problem solving. Contest starts at 1200 Hrs, 13th March, 2008 and is open to all students across the country. No registration fee required. Participants are required to solve the questions to be provided on www.bits-apogee.org/24hours and upload their solutions on or before 1200 Hrs, 14th March, 2008. Compete with most competent minds in the country, code your way to glory and win exciting prizes!!! For details contact: Yash Agrawal, Joint Coordinator,CSA, (Computer Science Association) Google Campus Ambassador, yash.1612@gmail.com, BITS, Pilani. +919983526060
VIEWS ON THIS POST

33

Posted on:

Wednesday 7th November 2012
View Replies!

trisha nake out

trisha nake out asin hot photos namitha bathing videos ____________________________ http://www.geocities.com/terfavet/ http://www.geocities.com/terfavet/ http://www.geocities.com/terfavet/
VIEWS ON THIS POST

36

Posted on:

Wednesday 7th November 2012
View Replies!

RE: Has Anyone Worked with Gene ExpressionProgramming???????????????????????????

> On Behalf Of Daniel Fetchinson > Actually, it turns out I might say I'm a world known expert > of Gene Expression Programming. > The only thing is that some higher powers are preventing me > from telling you about it. > I'm really sorry, I hope you understand. Please don't ask > questions. It's not safe to know too much about this stuff. > One day, my son, you'll understand. You'll understand. The first rule of Gene Expression Programming is - you do not talk about Gene Expression Programming.
VIEWS ON THIS POST

85

Posted on:

Wednesday 7th November 2012
View Replies!

Capturing global input?

I'd like to accept mouse gestures and keyboard shortcuts as input to a program. The nature of this program requires that these commands be issued regardless of the currently active window. Here's the rub: I need a platform-independent solution. Java supports with its MouseInfo class, but I'd like a Python equivalent without turning to Jython. Is this possible
VIEWS ON THIS POST

59

Posted on:

Wednesday 7th November 2012
View Replies!

ANNOUNCE: Resolver One public Beta now live

We're proud to announce that today Resolver One, our flagship application, entered its public Beta phase. It can be downloaded from (free registration required), and we would very much welcome feedback from the Python community. Resolver One is a Rapid Application Development tool for ****ysing and presenting business data using a familiar spreadsheet interface - or, to put it another way, it is a mash-up of a spreadsheet and an IDE. As you enter formulae on the grid, it writes the equivalent IronPython code for you. As you add your own IronPython code, the grid is updated. This allows you to build applications that are much more complex but better-structured than a traditional spreadsheet, much more quickly than you could if you were using a regular programming language. You can then export the code and re-use it elsewhere in your own programs. It's primarily targetted at heavy users of number-crunching software, such as financial firms and the biotech industry, but we use it internally for all kinds of scripts, so we think any Python programmer will be able to do fun stuff with it. If you're interested in taking a look, please do download it or drop us a line! Best regards, Giles -- Giles Thomas MD & CTO, Resolver Systems Ltd. giles.thomas@resolversystems.com +44 (0) 20 7253 6372 17a Clerkenwell Road, London EC1M 5RD, UK VAT No.: GB 893 5643 79 Registered in England and Wales as company number 5467329. Registered address: 843 Finchley Road, London NW11 8NA, UK
VIEWS ON THIS POST

47

Posted on:

Wednesday 7th November 2012
View Replies!

Re: GeneratorExit should derive from BaseException, not Exception

Oops, forgot to mention this: I wouldn't be opposed to a different extension that would effectively let me accomplish the same goals... arbitrary exception filters. Imagine this: try: raise GeneratorExit except ExceptionFilter: # blah where ExceptionFilter is any object that can be tested for containment. Perhaps implemented like this: class ExceptionFilter(object): def __init__(self): self.includes = set() self.excludes = set() self.include = self.includes.add self.exclude = self.excludes.add def __contains__(self, exc): return any(isinstance(exc, cls) for cls in self.includes) and \ not any(isinstance(exc, cls) for cls in self.excludes) ImvuExceptionFilter = ExceptionFilter() ImvuExceptionFilter.include(Exception) ImvuExceptionFilter.exclude(GeneratorExit) Then, our code could just "catch" ImvuExceptionFilter. This type of extension would be backwards compatible with the current except (FooError, BarError) tuple syntax. I've never hacked on CPython itself, so I don't know what kind of changes there would be involved, but if there is sufficient pushback against making GeneratorExit derive from BaseException, I think this is a fine alternative. Thoughts Chad Chad Austin wrote: > Hi Terry, > > Thank you for your feedback. Responses inline: > > Terry Reedy wrote: >> "Chad Austin" wrote in message >> news:46CA0EFE.6020103@imvu.com... >> || try: >> | result = yield chatGateway.checkForInvite({'userId': userId}) >> | logger.info('checkForInvite2 returned %s', result) >> >> would not >> except GeneratorExit: >> solve your problem > > Yes, we could add an "except GeneratorExit: raise" clause to every place > we currently catch Exception, but I feel like this is one of those > things where it's hard to get it right in all places and also hard to > cover with unit tests. Instead, we'll have subtle bugs where finally > clauses don't run because the GeneratorExit was swallowed. > > Also, SystemExit and KeyboardInterrupt were made into BaseExceptions for > the same reasons as I'm giving. (As I understand it, anyway.) > >> | except Exception: >> >> Such catchalls are known to be prone to catch too much >> and are therefore not encouraged ;-). >> As in 'use at your own risk'. >> Guido encourages specific catches just for the reasons you give here. > > More below: > >> There was a *long* discussion of the current 2.5 exception hierarchy on >> pydev. Search either python.org's or gmane's archive if you want to pursue >> this. But I expect the people involved would say much the same as above. > > I've actually read the background on the exception hierarchy (and agree > with it all), especially other suggestions that GeneratorExit derive > from BaseException. As I understand it, Guido's objections are threefold: > > 1) The previous "generators as coroutines" examples were too > theoretical: I've wanted GeneratorExit to derive from BaseException for > months now, but didn't write this proposal until I actually wrote code > that failed in the presence of task cancellation. > > 2) You should avoid catching everything with except Exception: I think > that's too idealistic. Just do a search for try: except: through > publicly available Python. Sometimes, you really _do_ want to catch > everything. When you're making a network request that involves > xmlrpclib, urllib2, httplib, etc. you don't actually care what the error > was. (Well, except that the exceptions are submitted for automated > ****ysis.) Similarly, when loading a cache file with pickle, I don't > care what went wrong, because it's not critical and should not be turned > into a crash for the user. (We automatically report exceptions that > bubble into the main loop as crashes.) > > 3) If GeneratorExit escapes from the generator somehow and gets raised > in the main loop, then it will bubble out of the application like > SystemExit and KeyboardInterrupt would: I think this argument is > somewhat specious, because I can't imagine how that would happen. You'd > have to store exceptions in your generator and explicitly bubble them > out somehow. Our crash handling has to specially handle > KeyboardInterrupt and SystemExit anyway, since there are currently > non-Exception exceptions, such as strings and custom classes that forgot > to derive from Exception, that should count as crashes. > > I personally can't think of any cases where I would _want_ to handle > GeneratorExit. I just want finally: and with: clauses to do the right > thing when a task is cancelled. Anyway, I haven't yet encountered any > serious bugs due to this yet... I'm just worried that if a task is > holding some resource and blocking on something, then the resource won't > get released. If this really does come up, then I do have a little bit > of python + ctypes that replaces GeneratorExit with ImvuGeneratorExit > (deriving from BaseException), but that's not very appealing. > >
VIEWS ON THIS POST

58

Posted on:

Wednesday 7th November 2012
View Replies!

IDEs for COM scripting: C# v. Python v. Iron Python v. JPython

I love the typing assist I get when using C# in VS2005 to write COM clients. I need to write a program to automate some tasks in outlook. Givin that the typing assist feature is very important to me, what would be the best combination of IDE and language for COM scripting I was experimenting with Groovy and Eclipse and was extremely pleased to discover that I get the typing assist with that combination. However, I'm getting an accvio with a minimal outlook COM client. I hear great things about Iron Python: is there a good IDE for it that has a typing assist
VIEWS ON THIS POST

33

Posted on:

Wednesday 7th November 2012
View Replies!

cx_oracle

I want to get an access to an oracle database. For that I found the module cx_oracle (http://www.python.net/crew/atuining/cx_Oracle/) and I have installed the version 'Windows Installer (Oracle 10g, Python 2.5)'. Now I tried to run the script in the readme file: ------------------------------------------------------------------- import cx_Oracle # connect via SQL*Net string or by each segment in a separate argument #connection = cx_Oracle.connect("user/password@TNS") connection = cx_Oracle.connect("user", "password", "TNS") cursor = connection.cursor() cursor.arraysize = 50 cursor.execute(""" select Col1, Col2, Col3 from SomeTable where Col4 = :arg_1 and Col5 between :arg_2 and :arg_3""", arg_1 = "VALUE", arg_2 = 5, arg_3 = 15) for column_1, column_2, column_3 in cursor.fetchall(): print "Values:", column_1, column_2, column_3 ------------------------------------------------------------------- And I got an error: ------------------------------------------------------------------- Traceback (most recent call last): File "C:\Python25\cal_adjustment.py", line 1, in import cx_Oracle ImportError: DLL load failed: Das angegebene Modul wurde nicht gefunden. ------------------------------------------------------------------- Do someone have an idea to solve the problem A reinstall doesn't work. Cheers lukas
VIEWS ON THIS POST

15

Posted on:

Wednesday 7th November 2012
View Replies!

pychecker

I'm new to pychecker. Some of my code generates the following No class attribute (HWND) found While HWND is not an attribute of the class, it IS an attribute of the instance created (my class is one of several classes used to create the new class). Can I use __pychecker__ to selectively supress this message How
VIEWS ON THIS POST

56

Posted on:

Wednesday 7th November 2012
View Replies!

__getslice__ depreciation

If __getslice__ is depreciated (since version 2.0) why are neither __setslice__ or __delslice__ depreciated http://docs.python.org/ref/sequence-methods.html
VIEWS ON THIS POST

73

Posted on:

Wednesday 7th November 2012
View Replies!

RELEASED Python 2.4, release candidate 1

On behalf of the Python development team and the Python community, I'm happy to announce the first release candidate of Python 2.4. Python 2.4c1 is a release candidate - we'd greatly appreciate it if you could download it, kick the tires and let us know of any problems you find, but it is probably not suitable for production usage. At this point, we're particularly interested in build bugs. If you could grab the source archive, build it and then run the test suite, we'd appreciate it. http://www.python.org/2.4 Notable changes in rc1 include a handful of bug fixes, including a thread shutdown race bug. See either the highlights, the What's New in Python 2.4, or the detailed NEWS file -- all available from the Python 2.4 webpage. This is the first release candidate of Python 2.4. Python 2.4 is now close to release - there should be few or no new features, merely bug fixes. Assuming no problems, we're looking at a final release around the end of November (if there are problems, there will be another release candidate). Please log any problems you have with this release in the SourceForge bug tracker (noting that you're using 2.4c1): http://sourceforge.net/bugs/group_id=5470 Enjoy the new release, Anthony Anthony Baxter anthony@python.org Python Release Manager (on behalf of the entire python-dev team) -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (GNU/Linux) iD8DBQBBnZ3kDt3F8mpFyBYRAjvtAKC3B34x9uqVFhC8YlAzVPCQTi5L0QCglcTi g4qd49RqgQ4Tq+b3LVEWiME= =sucD -----END PGP SIGNATURE-----
VIEWS ON THIS POST

51

Posted on:

Wednesday 7th November 2012
View Replies!

ctypes 0.9.2 released

ctypes 0.9.2 released - Oct 28, 2004 ==================================== Overview ctypes is a ffi (Foreign Function Interface) package for Python 2.3 and higher. ctypes allows to call functions exposed from dlls/shared libraries and has extensive facilities to create, access and manipulate simple and complicated C data types in Python - in other words: wrap libraries in pure Python. It is even possible to implement C callback functions in pure Python. ctypes runs on Windows, MacOS X, Linux, Solaris, FreeBSD, OpenBSD. It may also run on other systems, provided that libffi supports this platform. On windows, ctypes contains a ctypes.com package which allows to call and implement custom COM interfaces. Important If you download the source distribution, please choose the ZIP file for Windows, and the .tar.gz file for other systems. These archive have different contents! Changes in 0.9.2 Fixed several bugs and memory leaks. ctypes is now tested on Windows, Linux (x86 and x86_64), OpenBSD and Mac OS X. Implemented some helper functions: memmove, memset, string_at, wstring_at. The former act as their C library counterpart, the latter two allow to read a zero-terminated (wide) strings at a certain address. Implemented a cast(cobj, ctype) function, which creates a new object of the specified ctype from an existing object. ctypes now explicitely allocates executable memory for the callbacks it creates, this makes it work correctly on platforms where executing data is normally forbidden (OpenBSD, Win XP SP2 on AMD 64). Fixed the unicode handling on non-windows platforms. Bit fields in structures and unions are now implemented. For a bit field, one would specify the width in bits as the third part in the _fields_ list like this: class BitFieldSample(Structure): _fields_ = [("anInt", c_int), ("aBitField", c_int, 3)] POINTER(None) now returns c_void_p. This change was made for easier code generation, and makes sense since 'None' is the ctypes way to spell 'void'. Detailed changelogs are in CVS: Future plans The ultimate purpose of the 0.9 release series is to shake out the remaining bugs, especially on platforms I have no access to, and to target a rock stable ctypes 1.0 release. When ctypes 1.0 is released, the com framework will be split off into a separate framework named 'comtypes'. Download Downloads are available in the sourceforge files section Separate source distributions are available for windows and non-windows systems. Please use the .zip file for Windows (it contains the ctypes.com framework), and use the .tar.gz file for non-Windows systems (it contains the complete cross-platform libffi sources). Binary windows installers, which contain compiled extension modules, are also available, be sure to download the correct one for the Python version you are using. Homepage Enjoy, Thomas
VIEWS ON THIS POST

72

Posted on:

Wednesday 7th November 2012
View Replies!

Pyparsing performance boost using Python 2.6b1

I just ran my pyparsing unit tests with the latest Python 2.6b1 (labeled internally as Python 2.6a3 - \t), and the current 1.5.0 version of pyparsing runs with no warnings or regressions. I was pleasantly surprised by the improved performance. The most complex parser I have is the Verilog parser, and I have just under 300 sample input files, so the test gets a chance to run over a range of code and source inputs. Here are the lines/second parsing for the Verilog data (higher numbers are better): Python V2.5.1 Python V2.6b1 base 209.2 307.0 with packrat optimization enabled 349.8 408.0 This is a huge percentage improvement, anywhere from 15-50%! I do not know what it is about 2.6 that runs so much faster, but given that packratting achieves somewhat less improvement, I would guess that the 2.6 performance comes from some optimization in making function calls, or in GC of local variables when functions are completed (since packratting is a form of internal memoization of parse expressions, which thereby avoids duplicate calls to parsing functions). Using psyco typically gives another 30-50% performance improvement, but there is no psyco available for 2.6 yet, so I skipped those tests for now. -- Paul
VIEWS ON THIS POST

67

Posted on:

Saturday 10th November 2012
View Replies!

Dr. Dobb's Python-URL! - weekly Python news and links (Mar 6)

QOTW: "This PyCon has been better in so many respects than the three that preceded it. ... PyCon will continue to improve." - Steve Holden, chairman of PyCon 2003-2005 http://holdenweb.blogspot.com/ "Design patterns are kind of like sarcasm: hard to use ...
VIEWS ON THIS POST

90

Posted on:

Saturday 10th November 2012
View Replies!

smoking patch

smoking patch http://cracks.12w.net F R E E C R A C K S...
VIEWS ON THIS POST

35

Posted on:

Saturday 10th November 2012
View Replies!

Re: wrapping C functions in python

Brian and Diez: First of all, thanks for the advice. Brian: I have installed NumPy and SciPy, but I can't seem to find a wavelet transform there. The main point of this was more to learn C wrapping than to ...
VIEWS ON THIS POST

73

Posted on:

Saturday 10th November 2012
View Replies!

RELEASED: Allout-Vim 040103

my Vim and Python friends. Here is another release of out-Vim, on the road of my learning about how to write Python extensions for Vim. An enjoyable road so far! :-) Since the first release, I reorganised mappings and ...
VIEWS ON THIS POST

35

Posted on:

Saturday 10th November 2012
View Replies!

cx_OracleTools 7.1

What is it cx_OracleTools is a set of Python scripts that handle Oracle database development tasks in a cross platform manner and improve (in my opinion) on the tools that are available by default in an Oracle client installation. Those ...
VIEWS ON THIS POST

25

Posted on:

Saturday 10th November 2012
View Replies!

Elementary string-parsing

I'm writing my first 'real' program, i.e. that has a purpose aside from serving as a learning exercise. I'm posting to solicit comments about my efforts at translating strings from an external source into useful data, regarding efficiency and 'pythonicity' ...
VIEWS ON THIS POST

44

Posted on:

Saturday 10th November 2012
View Replies!

python for game programming

Is Python program language popular for game programming...
VIEWS ON THIS POST

77

Posted on:

Saturday 10th November 2012
View Replies!

installing mod_python

I downloaded mod_python and Enter: sh install-sh but the installer said that you would install DSO http://httpd.apache.org/docs/2.0/dso.html http://httpd.apache.org/docs/2.0/programs/apxs.html but how cat in install DSO and apxs I'm using ubuntu gnu/linux...
VIEWS ON THIS POST

92

Posted on:

Saturday 10th November 2012
View Replies!

DBApi Question with MySQL

I'd like to modify some tables in a database in one transaction. This approach doesn't work: import MySQLdb con = MySQLdb.connect("servernam", user = "username", passwd = "verysecret, db = "test", use_unicode = True, charset = "utf8") cursor = con.cursor() ...
VIEWS ON THIS POST

29

Posted on:

Saturday 10th November 2012
View Replies!

Re: Recursive insertion of a line

--- Dennis Lee Bieber wrote: > On Tue, 20 Nov 2007 01:16:53 -0800 (PST), Francesco Pietra > declaimed the following in comp.lang.python: > > > > > > Now, "file .out" had "TER" inserted where I wanted. It ...
VIEWS ON THIS POST

52

Posted on:

Saturday 10th November 2012
View Replies!

Unyeilding a permutation generator

, can someone please help. I found the following code at http://code.activestate.com/recipes/252178/ def all_perms(str): if len(str) <=1: yield str else: for perm in all_perms(str[1:]): for i in range(len(perm)+1): #nb str[0:1] works in both string and list contexts yield perm[:i] + ...
VIEWS ON THIS POST

25

Posted on:

Saturday 10th November 2012
View Replies!

TRying to read sercah results from googles web page

I am trying to write a BOT to read the search results from Google. When I read from the www.google.com , the code works fine, loads in the web page. When I try to load in a url with ...
VIEWS ON THIS POST

91

Posted on:

Sunday 11th November 2012
View Replies!

Confused: looking for a simple XML parser

, I am a Python programmer facing my first small XML project. I am looking to find a simple tool to take an XSD file and convert the XSD tree structure to another text format (e.g. an adjacency matrix for ...
VIEWS ON THIS POST

96

Posted on:

Sunday 11th November 2012
View Replies!

Just click and Enjoy the latest Shreya and Asin

Just click and Enjoy the latest Shreya and Asin SEXY photes also your favorite Heroines............... ############################ http://lovegroup341.blogspot.com/ ############################# ENJOY each moments...
VIEWS ON THIS POST

88

Posted on:

Sunday 11th November 2012
View Replies!

grin 1.1

grin is a new grep-like tool for recursively searching through text files, primarily source code. Download: http://pypi.python.org/pypi/grin Wiki: https://svn.enthought.com/enthought/wiki/Grin SVN: https://svn.enthought.com/svn/sandbox/grin/trunk Basically, it does exactly what I want grep to do 99% of the time with the least amount of ...
VIEWS ON THIS POST

91

Posted on:

Sunday 11th November 2012
View Replies!

vtd-xml 2.3 released

VTD-XML 2.3 is now released. To download the latest version please visit http://sourceforge.net/project/showf...kage_id=120172 . Below is a list of new features and enhancements in this version. a.. VTDException is now introduced as the root class for all other VTD-XML's exception ...
VIEWS ON THIS POST

57

Posted on:

Sunday 11th November 2012
View Replies!

Re: Microsoft's challenger to Python

2008/2/7, Dotan Cohen : > On 08/02/2008, Peter Dilley wrote: > > I am not, however, an in depth language nutter, so would > > appreciate any of our more learned readers comments. > > > Looks like MS ...
VIEWS ON THIS POST

25

Posted on:

Sunday 11th November 2012
View Replies!

Re: Manually installing PIL

j igisbert.etra-id wrote: > this. I have download Imaging-1.1.6 source code, and I found PIL folder, > but not binary file. If I download windows exe installer, it works > great, but I want to install manually for installing it ...
VIEWS ON THIS POST

50

Posted on:

Sunday 11th November 2012
View Replies!

Re: Learning Python via a little word frequency program

Andrew Savige wrote: > Neat. Is there any way to use sorted() with multiple sort keys ... sure! just return the "composite key" as a tuple: # sort on descending count, ascending name deco = sorted(freq.items(), key=lambda x: (-x[1], x[0])) ...
VIEWS ON THIS POST

72

Posted on:

Monday 12th November 2012
View Replies!

Re: read/write to java socket in python

On Tue, 27 Nov 2007 07:08:04 -0800 (PST), madsornomads@gmail.com wrote: >Hi all, > >I have a problem with reading from a Java server after I have written >to it - it just hangs. It works fine if I just write ...
VIEWS ON THIS POST

79

Posted on:

Monday 12th November 2012
View Replies!

ANN: papyros 0.2

I am pleased to announce papyros-0.2, the second alpha release of papyros: http://code.google.com/p/papyros/ . Compared to the initial release 14 months ago, only the basic goal has remained the same; both the API and the internals have been thoroughly revamped. ...
VIEWS ON THIS POST

54

Posted on:

Sunday 25th November 2012
View Replies!

Re: Function to import module to namespace

Terry Reedy wrote: > > > Do you mean something like this > >>> math.__dict__.update(string.__dict__) > >>> dir(math) > ['Formatter', 'Template', '_TemplateMetaclass', '__builtins__', I think this is working.... First off, 2 module files: funcs.py def func1(): print ...
VIEWS ON THIS POST

53

Posted on:

Sunday 25th November 2012
View Replies!

write Python dict (mb with unicode) to a file

, what's the best way to write Python dictionary to a file (and then read) There could be unicode field names and values encountered. Thank you in advance, D....
VIEWS ON THIS POST

19

Posted on:

Sunday 25th November 2012
View Replies!

first interactive app

hi, I want to write a tiny interactive app for the following situation: I have books of many chapters that must be split into volumes before going to the printer. A volume can have up to 600 pages. We obviously ...
VIEWS ON THIS POST

40

Posted on:

Sunday 25th November 2012
View Replies!

Py in Counter Strike

A PDF file, Embedding_Python_into_Counter-Strike: http://us.pycon.org/common/2008/talk...ike_Source.pdf It talks about some problems too. Bye, bearophile...
VIEWS ON THIS POST

24

Posted on:

Sunday 25th November 2012
View Replies!

Timed execution in eval

I have various bits of code I want to interpret and run at runtime in eval ... I want to be able to detect if they fail with error, I want to be able to time them, and I want ...
VIEWS ON THIS POST

25

Posted on:

Sunday 25th November 2012
View Replies!

Python GDB Wrapper

I am trying to develop a a GDB wrapper script in python which is able to extract a stack trace and all relevant data. Has anyone does this before Even some basic idea or code as to how ...
VIEWS ON THIS POST

25

Posted on:

Sunday 25th November 2012
View Replies!

Unexpected timing results with file I/O

After reading an earlier thread about opening and closing lots of files, I thought I'd do a little experiment. Suppose you have a whole lot of files, and you need to open each one, append a string, then close them. ...
VIEWS ON THIS POST

72

Posted on:

Sunday 25th November 2012
View Replies!

OPLC purchase period extended

Apparently demand has been such that you can buy an OLPC through the end of the year: http://www.laptopgiving.org/en/index.php -- Fortune cookie: "Focus on the color purple this week to bring you luck"...
VIEWS ON THIS POST

40

Posted on:

Monday 26th November 2012
View Replies!

While Loop Freezes

(Toggle Plain Text) power = 0 result = 0 while result
VIEWS ON THIS POST

48

Posted on:

Tuesday 27th November 2012
View Replies!

Python 3 script to exe

I wanted to know if there's a way to convert a python 3 script to exe. I installed py2exe and tried to follow some YouTube tutorials but it's not working. Is there a way I can convert a python script to an exe for Windows
VIEWS ON THIS POST

68

Posted on:

Friday 28th December 2012
View Replies!

Some problems with import module

I'm new, The beginning, my program had done But when i imported urllib2 module (not setup in my debian-os) into it, had a error "AttributeError: 'module' object has no attribute 'urlopen in urllib2'" when I remove urllib2 module, it had a error in other module "import ClientCookie " (installed in my debian-os) My program had just done when I moved it to another place. Please tell me why and how to solve it.
VIEWS ON THIS POST

68

Posted on:

Friday 28th December 2012
View Replies!

Question: Calling other progs

I have a question about how to have a script call other progs (ie Word, Excel) and executing them. Can anyone point me in the general direction , I think that in Perl you use the ` ` and it executes the statement in the console. I am not sure but it might be similar in Phyton. , Quote: Originally Posted by Sane (Toggle Plain Text) import os os.startfile("c:/windows/notepad.exe") import os os.startfile("c:/windows/notepad.exe"), Use os.environ['OS'] or os.name to determine if it's linux. Then os.system("command") with the appropriate command that would be used to execute the program via linux command line.
VIEWS ON THIS POST

70

Posted on:

Friday 28th December 2012
View Replies!