Hi, I'm looking into using Lua in a web project. I can't seem to find any way of directly parsing in pure python and running Lua code in Python.
Does anyone know how to do this?
Joe
Hi,
I wrote a python module. Running python filename.py, only checks for syntax errors. Is there a tool, which checks for runtime errors also, like concatenating int with string etc..
Thank you
Bala
I'm writing a simple alarm utility in Python.
#!/usr/bin/python
import time
import subprocess
import sys
alarm1 = int(raw_input("How many minutes (alarm1)? "))
while (1):
time.sleep(60*alarm1)
print "Alarm1"
sys.stdout.flush();
doit = raw_input("Continue (Y/N)?[Y]: ")
print "Input",doit
if doit == 'N' or doit=='n':
print "Exiting....."
break
I want to flush or discard all the key strokes that were entered while the script was sleeping and only accept the key strokes after the raw_input() is executed.
Hi everyone,
I have the following input:
input = [(dog, dog, cat, mouse), (cat, ruby, python, mouse)]
and trying to have the following output:
outputlist = [[0, 0, 1, 2], [1, 3, 4, 2]]
outputmapping = {0:dog, 1:cat, 2:mouse, 3:ruby, 4:python, 5:mouse}
Any tips on how to handle given with scalability in mind (var input can get really large).
File "/usr/local/lib/python2.5/site-packages/libxml2.py", line 1, in <module>
import libxml2mod
ImportError: /usr/local/lib/python2.5/site-packages/libxml2mod.so:
undefined symbol:xmlTextReaderSetup
>>> import libxml2mod
>>> import libxml2
>>>
on Python Prompt it works fine !!
can anyone has idea why my program is not working from .py file as import is working perfect from python prompt.
I am using python and want to create a fullscreen window. I know about the pygame.FULLSCREEN flag but when I use that there's areas of black around the screen. Is there any way to get the monitor size using python so I can make the window the correct size?
Can someone please give the Java equivalent of the below python (which slices a given array into given parts) which was originally written by ChristopheD here:
def split_list(alist, wanted_parts=1):
length = len(alist)
return [ alist[i*length // wanted_parts: (i+1)*length // wanted_parts]
for i in range(wanted_parts) ]
I don't know any python but can really use the above code in my Java app. Thanks
Hi,
I am writting a python script and I am running out of time. I need to so some things that I know pretty well in bash, so I just wonder how can I embed some bash lines into a python script.
Thanks
Hi,
Is there a way to declare a constant in Python. In java I will we can create constant in this manner:
public static final String CONST_NAME = "Name";
What is the equivalent of the above java constant declaration in python ?
Cheers,
Hi Everyone,
I am really new to Python, and programming in general, but I have a python script I would like to run at regular intervals. I am running windows 7. What is the best way to accomplish this? Easiest way?
Any help you can provide will be very much appreciated!
Brock
I have Python classes, of which I need only one instance at runtime, so it would be sufficient to have the attributes only once per class and not per instance. If there would be more than one instance (what won't happen), all instance should have the same configuration. I wonder which of the following options would be better or more "idiomatic" Python.
Class variables:
MyController(Controller):
path = "something/"
childs = [AController, BController]
def action(request):
pass
Instance ariables:
MyController(Controller):
def __init__(self):
self.path = "something/"
self.childs = [AController, BController]
def action(self, request):
pass
I've just downloaded OpenCV's trunk and now I'm trying to build it with MinGW. I read the manual and get .dll's compiled, but that's all - "interfaces/python" contains only some .i and .cmake files. How can I really get new python interface? Where I can find new cv.pyd/libcv.dll.a (because a compiled version from official site crashes sometimes and I saw this bug as "fixed" in Trac)?
I have a bunch of HTML files I downloaded using HTTPLIB2 package in Python. ' ' are showing as 'Â '.
02/12/2004Â is showing while 02/12/2004 is the desired format.
How do I replace the 'Â ' with ' ' in Python? Thanks a lot!
Is there any python library that can keep a client-side SQLite database in sync with a server-side PostgreSQL database?
There are solutions for Java, such as Daffodil or SymmetricDS. Is there something similar for python?
Hello
i want to create a python application that consume a php nusoap webservice
and get the result and save it in database
what is the best way to do that using python
regards
In Python, is there a mean to enforce the use of spaces or tabs indentation with a per file basis ?
Well, perhaps "enforce" is too strong, its more like "recommands".
I keep getting files with mixed indentation and this is annoying... (to say the least) Python itself can tell when there is a problem, but I am searching something to do that at the editor level, like it exists for the charset.
Hi all,
Matplotlib and pylab doesn't work in python cgi. but it's working properly in python shell.. Any one can help me....... Plz.......
Thanks in advance......
Hi guys, I had written a program in Python 3, but now want to convert it into Python 2 code. Are there any utilities to do that automatically?
Thanks, R
When I try to print a Unicode string in a windows console, I get a "UnicodeEncodeError: 'charmap' codec can't encode character ...." error. I assume this is because the Windows console does not accept Unicode-only characters. What's the best way around this? Is there any way I can make Python automatically print a "?" instead of failing in this situation?
Edit: I'm using Python 2.5.
I'm writing a web app using Python and the web.py framework, and I need to use memcached throughout.
I've been searching the internet trying to find some good documentation on the python-memcached module, but all I could find was this example on the MySQL website, and the documentation on its methods isn't great.
How would you prompt the user for some input but timing out after N seconds?
Google is pointing to a mail thread about it at http://mail.python.org/pipermail/python-list/2006-January/533215.html but it seems not to work. The statement in which the timeout happens, no matter whether it is a sys.input.readline or timer.sleep(), I always get:
<type 'exceptions.TypeError'>: [raw_]input expected at most 1 arguments, got 2
which somehow the except fails to catch.
Hi All,
I know that there is the PyObjC bridge is OSX and what I want to do is to put a python application/script in the rightclick context menu of OS X. there is the OnMyCommand plugin but I dont think that supports python. I've had a look at how to do it in Carbon/ Objective-C and i'll admit it im a wuss and am just not smart enough yet to grok how to do it (I aint even close to groking it actually.)
Anybody got any idea's on how I might go about this?
Cheers
The Ruby LESS gem looks awesome - and I am working on a Python/Pylons web project where it would be highly useful. CSS is, as someone we're all familiar with recently wrote about, clunky in some important ways. So I'd like to make it easier on myself.
Is there an existing Python module or library that provides parallel functionality?