Symbolic Constants or Symbolic names in python


I want to know how symbolic constants can be used in python.

I have been writing programs for past one month and now programs are getting longer and requiring frequent and variable updates.

So, can anyone suggest how is this done in python.

Is there nothing like the one in C

(Toggle Plain Text) #define text replacement_text #define text replacement_text
Posted On: Friday 28th of December 2012 05:26:25 AM Total Views:  176
View Complete with Replies

RELATED TOPICS OF Python Programming PROGRAMMING LANGUAGE




Python and Tkinter Programming--Expensive!

Why is the book in Subject (author is Grayson) so expensive $100 on Amazon and $195 on ABE. Aren't there alternatives -- Wayne Watson (Nevada City, CA) Web Page:
VIEWS ON THIS POST

63

Posted on:

Monday 5th November 2012
View Replies!

measuring regression pass rate

Is there a script available online something similar that can connect to the database, get the regression database results and display a graph of pass rate onto the web page.
VIEWS ON THIS POST

93

Posted on:

Monday 5th November 2012
View Replies!

[ANN] testosterone 0.4.0 -- a manly Python testing interface

, I am pleased to announce the release of testosterone, a manly Python testing interface. testosterone is a test runner for unittest tests, featuring an elegant curses(3) interface. Screencast, documentation, and downloads are all available at: http://www.zetadev.com/software/testosterone/ Thank you. Chad Whitacre http://www.zetadev.com/
VIEWS ON THIS POST

83

Posted on:

Monday 5th November 2012
View Replies!

[ANNOUNCE]: functional 0.6 released

all, I have released version 0.6 of my functional module, a collection of higher-order and functional programming tools for Python. Currently offered are tools for function composition, partial function application, plus flip, foldl, foldr, scanl and scanr functions. Two version of the release are available: one is written in pure Python and aims for maximum readability and portability. The other is coded as a C extension module and is focused on raw performance. Where to get it: ######### functional is available from the project's website at http://oakwinter.com/code/functional/download/ and from the Python Package Index at http://cheeseshop.python.org/pypi/functional. Both source tarballs and Python Eggs are available for both the pure Python and C releases. Eggs are available for Python versions 2.3, 2.4 and 2.5. Release Notes ######## + flip will now reverse all non-keyword arguments, as opposed to simply reversing the first two as it did in version 0.5 (by popular request). + functional.compose now comes with an optional unpack parameter to make up for the fact that Python functions aren't fully curried. The unpack parameter means that you can now do something like this with compose: >>> f(*g(*arg,**kw)) i.e., automatically unpacking g's return value and passing the result to f. To get this functionality, you'd write something like: >>> compose(f, g, unpack=True)(*args, **kwargs) This was impossible with functional 0.5. + Weakref support has been added to flip and compose objects in the C version. + Sundry performance improvements for the C implementation. As always, feedback welcome! Collin Winter
VIEWS ON THIS POST

71

Posted on:

Monday 5th November 2012
View Replies!

ANN: SC-Shool-ID

Dear all, I am very happy to anounce the release of SnakeCard's School-ID, a school/university Smart Card based security solution that can be extended using Python or other languages that can "talk" to Python modules. The current release includes the following features: Student/Faculty Identification Data Security File Encryption PC Access E-purse Network Integration Grade Book Management Library Books Checkout Management Attendance Management Report Card Management Health/Emergency Information Retrieval The card can also be extended to areas such as web and building security. I invite you to look at the online presentations of the features at http://www.snakecard.com/page2.html where you may also download the brochure. Best regards, Philippe
VIEWS ON THIS POST

30

Posted on:

Monday 5th November 2012
View Replies!

PyPy Trillke Sprints Feb/March 2007

========================================================================= PyPy Trillke "EU and beyond!" sprints (25-28th Feb, 1-5th March 2006) ========================================================================= ... image:: http://www.trillke.net/images/HausPa...0304_113kb.jpg Some two years and some thousands of commits later, the EU project period of the PyPy (http://codespeak.net/pypy) project is about to close ... and a new period to begin: we are going for a sprint of three days of focusing on EU reports and administrative issues, and another three day sprint of happy hacking on the numerous interesting open ends of PyPy, the source code. We also intend to discuss and state our view on the time after the EU period (March 2007 is the last EU funded month), because clearly the project will not stop after our successful (knock knock!) completion of the EU project. It's already clear that some of us seriously plan for a relaxation time, i.e. one without having many obligations. But that should not keep us from thinking and envisioning the development from April on. So to the Sprint: we have two parts of the sprint, first the EU and second the public all-invited part:: 26th Feb - 28th Feb EU reports and adminstrative sprint 1st March break day / arrival for coding sprint 2nd March - 4th March public coding "beyond EU" sprint days days are meant as full days, so please arrive 25th Feb / 1st March and leave 5th March if you can (this help us with pairing, introductions and logistical planning). --------------------------------------------- Possible Topics for the coding sprint --------------------------------------------- * working on .NET, Java and other backends * working on the Javascript, Prolog or a new frontend * Tuning the JIT, refining approaches `[1]`_ * Fixing PyPy-1.0 problems / improving it (PyPy-1.0 is scheduled for Mid February, btw) * improving the py lib/py.test, build environments, preparing for server administration efforts from April on * Work on/with prototypes that use the new features that PyPy enables: distribution `[2]`_ (based on transparent proxying `[3]`_), security `[4]`_, persistence `[5]`_, etc. `[6]`_. * discussion about the time after March, and how to organize/co-ordinate ourselves * all topics that are of interest otherwise (including maybe working on some particular EU related topics still!) ... _[1]: http://codespeak.net/pypy/dist/pypy/doc/jit.html ... _[2]: http://codespeak.net/svn/pypy/dist/p...b/distributed/ ... _[3]: http://codespeak.net/pypy/dist/pypy/doc/proxy.html ... _[4]: http://codespeak.net/pypy/dist/pypy/....html#security ... _[5]: http://codespeak.net/pypy/dist/pypy/...ml#persistence ... _[6]: http://codespeak.net/pypy/dist/pypy/...ect-ideas.html ----------------------- Location ----------------------- The sprint takes place at the Trillke Gut Steinbergstr. 42 Hildesheim, Germany http://www.trillke.net If you come to Hildesheim main station, take the Bus Number 3 (Hildesheimer Wald) and get out at "Waldquelle". Walking back a 100 meters gets you to a small street on the right leading to a big white building, the Trillke Gut. We'll have at least one larger room for sprinting, and a kitchen for our use. ----------------------- Accomodation ----------------------- We can probably arrange for some cheap or no-cost private accomodation, in private rooms located up in the house (and being part of "living groups" of 5-10 people). There also is a nice Guest house that has been used during recent events: http://www.gaestehaus-klocke.de/ and a four-star hotel 500 meters away from the Trillke: http://www.berghoelzchen.de/ ----------------------- Registration ----------------------- please subscribe to the pypy-sprint mailing list http://codespeak.net/mailman/listinfo/pypy-sprint and register by subversion: http://codespeak.net/svn/pypy/extrad...007/people.txt or - if you have no checkin-rights - post to the pypy-sprint list above. -- merlinux GmbH Steinbergstr. 42 31139 Hildesheim http://merlinux.de tel +49 5121 20800 75 (fax 77)
VIEWS ON THIS POST

64

Posted on:

Monday 5th November 2012
View Replies!

Re: Interface to Matlab

Claire Mouton wrote: > > > I would like to call Python functions from Matalab. > How could I find an interface from Matlab to Python http://mlabwrap.sourceforge.net/ -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco
VIEWS ON THIS POST

21

Posted on:

Wednesday 7th November 2012
View Replies!

Three days with some of the coolest people in ruby and rails

What could be cooler than Ruby and Rails authors, experts, and hundreds of professionals that work with Ruby on a daily basis all together in one location for great discussions and debates Thats what will happen at the Voices That Matter: Professional Ruby Conference coming to Boston, November 18-20th. Obie Fernandez - Giles Bowkett Josh Susser - Blaine Cook - Ezra Zygmuntowicz - Michael Hartl - Thomas Enebo - Hal Fulton - and dozens of others! You should join us! Well be talking about some intriguing topics and there will be lots of time for Q&A and code sharing. Itll be educational and itll be fun. Give us a call or send us an email now and well tell you all about the event and provide you with a free eBook. To request more information and receive your free eBook, email Barbara.Gavin@PearsonEd.com, call 617-848-7026, or request information online at http://www.voicesthatmatter.com/ruby2008/index.aspx. -hjk1127
VIEWS ON THIS POST

97

Posted on:

Wednesday 7th November 2012
View Replies!

Pyjamas 0.3 Release: python-to-javascript compiler and AJAX library

Pyjamas 0.3 ----------- Pyjamas is a python-to-javascript compiler and an AJAX-based Widget toolkit for Web Development (for the sister project, running pyjamas-based apps on the desktop, see http://pyjd.sf.net which is based on http://webkit.org). Pyjamas Applications are written in python, yet run in all major web browsers - as javascript. Specifically, the 0.3 release adds support for IE7. Pyjamas is a port of Google Web Toolkit to python. So, where GWT is a Java-to-Javscript compiler plus widget set, Pyjamas is a python-to-javascript compiler plus widget set. Documentation and details are available at the web site, http://pyjamas.sf.net Download available at: https://sourceforge.net/project/show...roup_id=239074
VIEWS ON THIS POST

94

Posted on:

Wednesday 7th November 2012
View Replies!

RELEASED Python 2.6rc2 and 3.0rc1

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On behalf of the Python development team and the Python community, I am happy to announce the second and final planned release candidate for Python 2.6, as well as the first release candidate for Python 3.0. These are release candidates, so while they are not suitable for production environments, we strongly encourage you to download and test them on your software. We expect only critical bugs to be fixed between now and the final releases. Currently Python 2.6 is scheduled for October 1st, 2008. Python 3.0 release candidate 2 is planned for October 1st, with the final release planned for October 15, 2008. If you find things broken or incorrect, please submit bug reports at http://bugs.python.org For more information and downloadable distributions, see the Python 2.6 website: http://www.python.org/download/releases/2.6/ and the Python 3.0 web site: http://www.python.org/download/releases/3.0/ See PEP 361 for release schedule details: http://www.python.org/dev/peps/pep-0361/ Enjoy, - -Barry Barry Warsaw barry@python.org Python 2.6/3.0 Release Manager (on behalf of the entire python-dev team) -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (Darwin) iQCVAwUBSNHpw3EjvBPtnXfVAQLW9wP/RBCaUvhuheIh+BjLLIHQFBQi7D3uVgqi l0+4fhhoKGJvtWklLfSM9I1prcjH/d6tzUu4fIOjX7aM+wZSG++vkfmBoehnhyZW AvU9Lax4mqDwhOJA2QA0WMx0obpYYVHeUl7D1g9kWzbRUkZDX9NZGMWThhEOC1qA UA3bBYbvWiQ= =BFNH -----END PGP SIGNATURE-----
VIEWS ON THIS POST

42

Posted on:

Wednesday 7th November 2012
View Replies!

Re: firefox timestamp

abhilash pp wrote: > I don't know if this question will fit on this section, > any way my query is , i have used one script demork.py to extract > details from Firefox history.dat file > and now the problem is how to convert the TIMESTAMP given by that to > normal date and time. > example timestams are like this, > > 1202919771609375 > 1213874676203125 > 1215693263859375 > > i have used datetime module for this but it gave me error a quick googling indicates that the file contains microseconds, not seconds. dividing by 1e6 should do the trick: >>> t = 1202919771609375 >>> datetime.datetime.fromtimestamp(t / 1e6) datetime.datetime(2008, 2, 13, 17, 22, 51, 609375)
VIEWS ON THIS POST

177

Posted on:

Wednesday 7th November 2012
View Replies!

HDF5 for Python 0.3.0

======================================= Announcing HDF5 for Python (h5py) 0.3.0 ======================================= HDF5 for Python (h5py) is a general-purpose Python interface to the Hierarchical Data Format library, version 5. HDF5 is a versatile, mature scientific software library designed for the fast, flexible storage of enormous amounts of data. The h5py project has been under informal development for a few months now, and has reached the point where it might be generally useful to others. Unlike the fantastic PyTables project, h5py aims to provide access to the full HDF5 C library, although in a more Pythonic fashion. Almost all of the HDF5 1.6.X API is covered, with improvements like: - object-oriented identifiers with reference counting - automatic raising of Python exceptions for HDF5 errors - conversion between NumPy and HDF5 datatypes It also includes a set of high-level, pure-Python classes which represent basic HDF5 abstractions like files, groups, and datasets, using native Python and NumPy infrastructure. For example, datasets carry a shape tuple and dtype, and support partial I/O via the standard extended slicing syntax. The primary focus of the project is read/write interoperability with existing HDF5 data; using Python and the NumPy package, you can access data in HDF5 format, process it, and write files that any HDF5-aware program can understand. Automatic conversion is provided between NumPy and HDF5 datatypes; almost all NumPy types can be transparently converted to their HDF5 equivalents. This includes constructs like complex numbers in addition to arbitrarily nested compound ("recarray") data types. Resources ========= Python 2.5 and Numpy >= 1.0.3 are required. For UNIX, a C compiler is also required which can build Python extensions. HDF5 versions 1.6.5, 1.6.7, 1.8.0 and 1.8.1 are supported. The Windows installer includes HDF5 1.8.1. Source installers for UNIX and an integrated installer for Windows are available from the Google Code development page: http://h5py.googlecode.com Comprehensive documentation, including installation instructions and a quick-start guide, is available at: http://h5py.alfven.org You can read more about the HDF5 library at the HDF Group web site: http://www.hdfgroup.com/HDF5 *** This project is NOT affiliated with the HDF Group. *** code for this project is released under the BSD license.
VIEWS ON THIS POST

34

Posted on:

Wednesday 7th November 2012
View Replies!

Are makepy-generated COM wrapper classes distributable?

Hi! I've just written a Python speech-recognition module (http:// pyspeech.googlecode.com). It provides a clean and simple interface to the Microsoft Speech SDK using COM wrapper classes generated by PythonWin's MakePY utility. Once this is a mature module, I'd like to make it as useful as possible to the community, so I'd like to make installation as simple as possible. Currently, to get speech.py to work, you must first: * install the Microsoft Speech SDK onto a Windows box, and * possibly install PythonWin, and then * run PythonWin's MakePY utility to generate modules into the gen_py dir. I'd like to remove the MakePY steps, so that as long as a user has run the SDK installer, she can install the 'speech' package and be ready to use it. Can I somehow bundle the generated modules into my setuptools package so that the wrappers are installed at the same time (If so, how -- just copy them into the package directory) Or are the wrappers targeted to my machine or installation, so that is forced to go through this
VIEWS ON THIS POST

115

Posted on:

Wednesday 7th November 2012
View Replies!

Check if module is installed

How to check is a library/module is installed on the system I use the next code but it's possivle that there is a best way. ------------------- try: import foo foo_loaded = True except ImportError: foo_loaded = False -------------------
VIEWS ON THIS POST

42

Posted on:

Wednesday 7th November 2012
View Replies!

xml.dom's weirdness?

Why this generates AttributeError, then not Python 2.5.2 (r252:60911, Apr 21 2008, 11:17:30) [GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import xml >>> xml.dom Traceback (most recent call last): File "", line 1, in AttributeError: 'module' object has no attribute 'dom' >>> xml.dom >>> , Lie wrote: > Question: Is there a way to list loaded modules, including those that > aren't in my namespace such as sys.modules Modules are not unloaded automatically just because you do not use them yourselves. If the module is imported for whatever reason by whatever other module, it stays alive until it's no longer referenced (including the reference in sys.modules). Stefan , On 28 Jul, 16:15, Sion Arrowsmith wrote: > Stefan Behnel wrote: > >Blame Ubuntu/Debian. > > I'd be wary about including Debian in that blame. Using 4.0 here, > with a 2.4.4 default and a 2.5.0 straight from the package: [...] I can imagine that some of the Python Eggs magic could quite easily inflate the number of files opened when doing imports. Information on things like the state of site-packages, .pth files, the length of PYTHONPATH and so on should surely accompany the numbers before fingers are pointed. Paul
VIEWS ON THIS POST

67

Posted on:

Wednesday 7th November 2012
View Replies!

How to find processes from Python

Is there a way how to find out running processesE.g. how many Appache's processes are running
VIEWS ON THIS POST

50

Posted on:

Wednesday 7th November 2012
View Replies!

Re: Reading a file

aditya shukla wrote: > I have a text file whose contents are like this:- > > jd|fj|dnv|jd|0.33|c:\\windows\\win32 > shcbsbs|nscsjsj|0.93|hsbcjsnc > > I am trying to read the file like this:- > > >>> x = open("c:\\a.txt","r") Better to use "rb" (for binary read) rather than "r" mode. > >>> x.read() Now, tell us what you *really* did. Not that -- that would read the contents of the file, put throw the returned result away. You must have done something like c = x.read() > > the result that i get is ike this:- > 'jd|fj|dnv|jd|0.33|c:\\\\windows\\\\win32\nshcbsbs|nscsjsj|0.93|hsbcjsnc\n' > > My doubt is how can i read the file as it is You *have* read the file as it is. Examine each character, and you'll see that the string is exactly as you expect. However, your output to the screen is escaping some character with backslashes. But that's just because of the method you used to print to the screen. What method *did* you use to print If you just typed the variable into which you had read the contents, then you get the equivalent of print repr(c) which explains the escapes. Try print c and that won't happen. Gary Herron > > ie my output should be > > d|fj|dnv|jd|0.33|c:\\windows\\win32 > shcbsbs|nscsjsj|0.93|hsbcjsnc > > >
VIEWS ON THIS POST

35

Posted on:

Wednesday 7th November 2012
View Replies!

One step up from str.split()

I normally use str.split() for simple splitting of command line arguments, but I would like to support, e.g., long file names which-- under windows -- are typically provided as simple quoted string. E.g., myapp --dosomething --loadthis "my file name.fil" ....and I'd like to get back a list wherein ListEntry[3]="my file name.fil" , but just running str.split() on the above string creates: >>> ListEntry='myapp --dosomething --loadthis "my file name.fil"' >>> ListEntry.split() ['myapp', '--dosomething', '--loadthis', '"my', 'file', 'name.fil"'] Is there an easy way to provide just this one small additional feature (keeping quoted names as a single entry) rather than going to a full-blown command-line argument parsing tool Even regular expressions seem like they'd probably be overkill here Or no
VIEWS ON THIS POST

43

Posted on:

Wednesday 7th November 2012
View Replies!

Adding functions to an existing instance

I need a way to add a method to an existing instance, but be as close as possible to normal instance methods. Using 'new' module or such code as 'def addfunc(...): def helper(...) .. setattr(...)' causes a cyclic reference which requires using 'gc.collect' to release the object. Also 'new' is deprecated. I also made a helper that uses weakref, but the problem is when the object is gone, existing instance method object would not work: f = myobject.function myobject = None f()
VIEWS ON THIS POST

31

Posted on:

Wednesday 7th November 2012
View Replies!

Re: Simple and safe evaluator

I'm finding my quest for a safe eval() quite frustrating Any comments on this: Just forget about getting python to do this and, instead, grab my set of values (from a user supplied text file) and call an external program like 'bc' to do the dirty work. I think that this would avoid someone from embedding os.system("rm ...") in what I thought would be a math expression and having it maybe do damage Perhaps I'm getting too paranoid in my old age. I guess this would slow things down a bit, but that is not a big concern. Bigger concern would be that I'm not sure if 'bc' or whatever is guaranteed to be on other platforms than *nix. And if I want to be really paranoid, I could worry that someone had planted a bad 'bc' on the target. , Matimus wrote: > > The solution I posted should work and is safe. It may not seem very > readable, but it is using Pythons internal parser to parse the passed > in string into an abstract symbol tree (rather than code). Normally > Python would just use the ast internally to create code. Instead I've > written the code to do that. By avoiding anything but simple operators > and literals it is guaranteed safe. > Just wondering ... how safe would: eval(s, {"__builtins__":None}, {} ) be From my testing it seems that it parses out numbers properly (int and float) and does simple math like +, -, **, etc. It doesn't do functions like int(), sin(), etc ... but that is fine for my puposes. Just playing a bit, it seems to give the same results as your code using ast does. I may be missing something!
VIEWS ON THIS POST

54

Posted on:

Wednesday 7th November 2012
View Replies!

Re: Code correctness, and testing strategies

Hi list. Do test-driven development or behaviour-driven development advocate how to do higher-level testing than unit testing >From reading up on the subject, I see that there are formally these types of testing: unit integration system acceptance I'm asking about this, because as suggested by various posters, I have written my latest (small) app by following a Behaviour-Driven Development style. The small app consists of about 5 relatively simple classes, each with behaviour tests, and mocks for the other objects it uses. I wrote the tests before any code (I cheated a bit here and there, like adding logging before adding logger mocks and tests to check that the logging took place). That went well, and the code ended up much more modular than if I hadn't followed BDD. And I feel more confident about the code quality than before ;-) The testing module has about 2x the lines of code as the code being tested. My problem is that I haven't run the app once yet during development :-/ It looks like I've fallen into the trap described here: http://en.wikipedia.org/wiki/Test-dr...egration_tests Should I go ahead and start manually testing (like I would have from the beginning if I wasn't following TDD), or should I start writing automated integration tests Is it worth the time to write integration tests for small apps, or should I leave that for larger apps I've tried Googling for integration testing in the context of TDD or BDD and haven't found anything. Mostly information about integration testing in general. When following BDD or TDD, should one write integration tests first (like the unit tests), or later Or don't those practices cover anything besides unit testing Which integration test process should one use (top down, bottom up, big bang, etc).
VIEWS ON THIS POST

62

Posted on:

Wednesday 7th November 2012
View Replies!

setuptools_bzr 1.2

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I'm happy to announce the setuptools_bzr 1.2 plugin for Python's setuptools. This allows setuptools to find your Python package files kept under the Bazaar revision control system. setuptools_bzr 1.2 should be compatible with Bazaar 1.5. This version fixes bug #237652 which prevented it from working correctly with loomified branches. It also adds an environment variable to force use of the command line bzr(1) even if bzrlib can be found. setuptools_bzr 1.2 is available in egg and source tarball format on the Python Package Index (a.k.a. Cheeseshop): http://pypi.python.org/pypi/setuptools_bzr/1.2 To use the plugin, just modify your setup() function in setup.py like so: setup(... setup_requires = [ 'setuptools_bzr', ], ...) The project home page is on Launchpad: https://launchpad.net/setuptoolsbzr Enjoy, - -Barry -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (Darwin) iQCVAwUBSEglFHEjvBPtnXfVAQKjKQP+KG8zfnIVvMXsqUEnpbgmZt1Cd6v1RJOv TXXB3Zef5XZerniEFIVZOcA00xQ3PHdpxJLghh3MWUv8wRSIyIgtlRNx+wbKXBWv fxCvVScWAnW+Zycg4hIM1kUWsYzB4JyGzU9PXRT5oZh5SM1EDYMSQPMrcErukRIg 0rIXw2Ht6KA= =kAS7 -----END PGP SIGNATURE-----
VIEWS ON THIS POST

86

Posted on:

Wednesday 7th November 2012
View Replies!

Take 5-10 min survey on animals, technology, and nature for a $20Barnes&Noble gift certificate

, I am a psychology student at University of Chicago conducting a survey on animals, technology, and nature. It takes only 5-10 minutes to complete and every 20th participant will be emailed a $20 gift certificate to Barnes & Noble. This should be an interesting opportunity to learn things about yourself as well. To participate, click on the link below. You may only take the survey once and will be ineligible if you do so more than once. To begin, click here: http://chicagogsb.qualtrics.com/SES...ZAKE&SVID=Prod
VIEWS ON THIS POST

59

Posted on:

Wednesday 7th November 2012
View Replies!

Best way to delimit a list?

Hi - I have a list returned from popen/readlines, and am wondering how to go about iterating over each item which was returned (rather than currently having the whole lot returned). so far: >>> f=os.open("./get_hostnames").readlines returns ['host1 host2 host3 ... hostN\n]' i'd like to be in a position to iterate through these, grabbing each host. I have played with transmuting to a str, and using split, and this works, but I get the subscript brackets from the list output as expected, as the list output is now a string literal, and this is not what I want - and I think it's a bit long-winded to do a search 'n replace on it - hence why I ask in the subject what's the best way. >>> f=str(f) >>> f.split() ["['host1","host2", ... ,"hostN\n']"]
VIEWS ON THIS POST

33

Posted on:

Wednesday 7th November 2012
View Replies!

Why is None

>>> None
VIEWS ON THIS POST

20

Posted on:

Wednesday 7th November 2012
View Replies!

Bigger projects, including files?

if i have a larger project and want to divide my program into several files, how do i include these files in the mainprogram using import someprojectfile doesnt work because import is for site- packages right and i dont want to put all my files in that folder. so how do i do it
VIEWS ON THIS POST

45

Posted on:

Wednesday 7th November 2012
View Replies!

A problem of twisted and dbus

, I am writing a program with twisted and dbus and got a such problem. If i run the code as $python local_proxy.py There is an error like this: Traceback (most recent call last): File "local_proxy.py", line 608, in reactor.listenTCP(143, factory) File "/usr/lib/python2.5/site-packages/twisted/internet/ posixbase.py", line 467, in listenTCP p.startListening() File "/usr/lib/python2.5/site-packages/twisted/internet/tcp.py", line 733, in startListening raise CannotListenError, (self.interface, self.port, le) twisted.internet.error.CannotListenError: Couldn't listen on any:143: (13, 'Permission denied'). So I tried to run the program as $sudo python local_proxy.py I got another error: Traceback (most recent call last): File "local_proxy.py", line 625, in session_bus = dbus.SessionBus() File "/var/lib/python-support/python2.5/dbus/_dbus.py", line 218, in __new__ mainloop=mainloop) File "/var/lib/python-support/python2.5/dbus/_dbus.py", line 107, in __new__ bus = BusConnection.__new__(subclass, bus_type, mainloop=mainloop) File "/var/lib/python-support/python2.5/dbus/bus.py", line 121, in __new__ bus = cls._new_for_bus(address_or_type, mainloop=mainloop) dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NoReply: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken. $sudo python local_porxy.py worked fine before I added the dbus into the program. And dbus has no problem for my other programs. How can I figure out this problem
VIEWS ON THIS POST

81

Posted on:

Wednesday 7th November 2012
View Replies!

Chicago Python Group, Thurs March 10

The Chicago Python User Group, ChiPy, will have its next meeting on Thursday, March 10, starting at 7pm. For more information on ChiPy see http://chipy.org Presentations ------------- This week we will have two presentations. Robert Ramsdell will talk about SimPy. SimPy (Simulation in Python) is an object-oriented, process-based discrete-event simulation language based on standard Python. It provides the modeler with components of a simulation model including processes, for active components like customers, messages, and vehicles, and resources, for passive components that form limited capacity congestion points like servers, checkout counters, and tunnels. It also provides monitor variables to aid in gathering statistics. Ian Bicking will be presenting on WSGI, WSGIKit, and Python web programming. WSGI is a new Python standard for interfacing between web servers (like Apache or Twisted) and web applications. WSGIKit is a reimplementation of Webware for Python using a series of WSGI components. He will be talking about its design and utilization of WSGI to create cross-framework libraries. Location -------- This month we will be having our first suburban meeting, in Downer's Grove: Acxiom 3333 Finley Road Downer's Grove Near the intersection of I-355 and Buttefield Road. Convenient to Fry's! Parking is plentiful. Some people are carpooling from the city -- contact the mailing list if you are interested.chiPy@lonelylion.com About ChiPy ----------- We meet once amonth, on the second Thursday of the month. If you can't come this month, please join our mailing list: http://lonelylion.com/mailman/listinfo/chipy
VIEWS ON THIS POST

23

Posted on:

Wednesday 7th November 2012
View Replies!

parsing .pcap files

Im using pyflag to parse .pcap files. Pyflag displays the data part of the .pcap file in binary and I was wondering what this means. How do I decode the 'data' part of the packet without using external libraries What does these non-alpha numerical information mean Is there a (python) dictionary/documentation somewhere that I can use to parse this data
VIEWS ON THIS POST

70

Posted on:

Saturday 10th November 2012
View Replies!

ANN: Urwid 0.9.7.1 - Console UI Library

Announcing Urwid 0.9.7.1 ------------------------ Urwid home page: http://excess.org/urwid/ Tarball: http://excess.org/urwid/urwid-0.9.7.1.tar.gz About this release: =================== This release fixes bugs introduced in the Padding and Overlay classes in the previous release. These bugs prevent the graph.py example program from running. New in ...
VIEWS ON THIS POST

28

Posted on:

Saturday 10th November 2012
View Replies!

ANN: Simulation package SimPy 1.4 has been released

SimPy (Simulation in Python) is a process-based discrete event simulation package. This new version of SimPy has significantly more capabilities than version 1.3. They have been developed from the ideas and with great collaboration of the very active SimPy user ...
VIEWS ON THIS POST

73

Posted on:

Saturday 10th November 2012
View Replies!

Preprocessing of input for the interactive interpreter?

, I just start learning Python (ordered "Dive into Python" a week ago). In the past I have used the Python interactive interpreter for some calculations instead of Linux command line tools like "bc" or "calc". I wonder if it ...
VIEWS ON THIS POST

135

Posted on:

Saturday 10th 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

83

Posted on:

Sunday 11th November 2012
View Replies!

Setting the value of one cell in QTableWidget fills everything.

I've just started PyQt programming and I've run into this little problem. When I set the text of one cell in my table, all the other cells fill with that value. I wanted to do was run a loop, ...
VIEWS ON THIS POST

58

Posted on:

Sunday 11th November 2012
View Replies!

appwsgi

can my http://appwsgi.googlecode.com/ be on the http://wsgi.org/ page somewhere please...
VIEWS ON THIS POST

33

Posted on:

Sunday 11th November 2012
View Replies!

ICDL Exam Cram? 2 - Syllabus 4.0

http://www.al3beer.com/vb/showthread.phpt=9179...
VIEWS ON THIS POST

49

Posted on:

Sunday 25th November 2012
View Replies!

Delete rows using xlrd?

I want to delete some rows (by creating a loop may be) using xlrd. Is this possible, if not how do I do that with python Please help
VIEWS ON THIS POST

93

Posted on:

Sunday 25th November 2012
View Replies!

Re: Problem with write binary data to OLE field in Access

lialie wrote: [... snip slightly confused indication that reading back a binary item using GetChunk appears to double its length ...] Well I don't know why this should be happening, but I do at least have a few suggestions: 1) ...
VIEWS ON THIS POST

28

Posted on:

Sunday 25th November 2012
View Replies!

My RPG Field Map Generator

This is for people who might want more script to examine and learn off of. I actually think this is very innovative and iffecient, I surprised myself greatly with this original script: area_1.py (Toggle Plain Text) from character_move import * ##import code shown in character_move.py from game_settings import * ##import video settings and image display functions def area_1(): character_location = ['',''] ##put where you want the character to start collision_1 = ['','','','',''] ##put the co-ordinates of the collision points in the format (rectangle or point), (x1), (y1), (x2), (y2) exclude the last two if you make the first one point collision_2 = ['','','','',''] collision_3 = ['','',''] collision_4 = ['','',''] collision_5 = ['','',''] collisions = [collision_1, collision_2, collision_3, collision_4, collision_5] ##if there are more collisions, add them in screen = video_settings() ##load the video settings to screen from the game_settings.py pygame.draw.rect(screen, (255, 255, 255), ( (250, 250), (550, 450) ), 0) ##create a white field in the space of the window character_location = character_move(screen, "area_map_1.bmp", character_location) ##enter the name of the picture for the areamap under "area_map_1.bmp" while 1: for event in pygame.event.get(): if event.type == KEYDOWN: c_o_l_l_i_s_i_o_n = check_collision(collisions, character_location, 0) if c_o_l_l_i_s_i_o_n == 0: if event.key == K_UP: character_location[1] = character_location[1] + 5 ##replace the values with the increments you want the character to move elif event.key == K_DOWN: character_location[1] = character_location[1] - 5 elif event.key == K_LEFT: character_location[0] = character_location[0] + 5 elif event.key == K_RIGHT: character_location[0] = character_location[0] - 5 c_o_l_l_i_s_i_o_n = check_collision(collisions, character_location, 0) if c_o_l_l_i_s_i_o_n == 1: if event.key == K_UP: character_location[1] = character_location[1] - 5 elif event.key == K_DOWN: character_location[1] = character_location[1] + 5 elif event.key == K_LEFT: character_location[0] = character_location[0] - 5 elif event.key == K_RIGHT: character_location[0] = character_location[0] + 5 character_location = character_move(screen, "area_map_1.bmp", character_location) #print character_location #area_1() from character_move import * ##import code shown in character_move.py from game_settings import * ##import video settings and image display functions def area_1(): character_location = ['',''] ##put where you want the character to start collision_1 = ['','','','',''] ##put the co-ordinates of the collision points in the format (rectangle or point), (x1), (y1), (x2), (y2) exclude the last two if you make the first one point collision_2 = ['','','','',''] collision_3 = ['','',''] collision_4 = ['','',''] collision_5 = ['','',''] collisions = [collision_1, collision_2, collision_3, collision_4, collision_5] ##if there are more collisions, add them in screen = video_settings() ##load the video settings to screen from the game_settings.py pygame.draw.rect(screen, (255, 255, 255), ( (250, 250), (550, 450) ), 0) ##create a white field in the space of the window character_location = character_move(screen, "area_map_1.bmp", character_location) ##enter the name of the picture for the areamap under "area_map_1.bmp" while 1: for event in pygame.event.get(): if event.type == KEYDOWN: c_o_l_l_i_s_i_o_n = check_collision(collisions, character_location, 0) if c_o_l_l_i_s_i_o_n == 0: if event.key == K_UP: character_location[1] = character_location[1] + 5 ##replace the values with the increments you want the character to move elif event.key == K_DOWN: character_location[1] = character_location[1] - 5 elif event.key == K_LEFT: character_location[0] = character_location[0] + 5 elif event.key == K_RIGHT: character_location[0] = character_location[0] - 5 c_o_l_l_i_s_i_o_n = check_collision(collisions, character_location, 0) if c_o_l_l_i_s_i_o_n == 1: if event.key == K_UP: character_location[1] = character_location[1] - 5 elif event.key == K_DOWN: character_location[1] = character_location[1] + 5 elif event.key == K_LEFT: character_location[0] = character_location[0] - 5 elif event.key == K_RIGHT: character_location[0] = character_location[0] + 5 character_location = character_move(screen, "area_map_1.bmp", character_location) #print character_location #area_1()
VIEWS ON THIS POST

181

Posted on:

Friday 28th December 2012
View Replies!