Can I use variable name "type" as function argument in Python?
Can I use type as name for a function argument? def fun(name, type): .... Thanks, Boda Cydo. ...
Can I use type as name for a function argument? def fun(name, type): .... Thanks, Boda Cydo. ...
I'm working with a wxPython grid, but I cannot set the background color of it (the grid part that isn't filled with cells). I tried with grid.SetBackgroundColour, but without luck; the backcolor shown is always the default system color for windows. wx.version() -> 2.8.10.1 (msw-unicode) sys.version -> 2.5 (r25:51908, Sep 19 2006, 09:5...
Hello everybody! Please advise library for working with soap in python. Now, i'm trying to use "suds". And i can't undestand how get http headers from server reply Code example: from suds.client import Client url = "http://10.1.0.36/money_trans/api3.wsdl" client = Client(url) login_res = client.service.Login("login", "password") var...
It is easy to programmatically use http or socks proxies from python in combination with urllib2, without changing system settings, but having looked at both the standard libraries and having searched on google I cannot see a straight forward way to do something similar with a vpn. I cannot change system settings but I could use any exte...
I have found two ways to extract matches in Python: 1. def extract_matches(regexp, text): matches = re.match(regexp, text) if matches: return matches.group(1) 2. def extract_matches(regexp, text): try: return re.findall(regexp, text)[0] except IndexError: return None Which one would you suggest me to use? And d...
I'm wondering if any had the chance to work on this: Using Python lib for AdWords, I want to select certain keywords that belongs to some adgroup. How to achieve that? ...
I'd like to use doctests to test the presence of certain warnings. For example, suppose I have the following module: from warnings import warn class Foo(object): """ Instantiating Foo always gives a warning: >>> foo = Foo() testdocs.py:14: UserWarning: Boo! warn("Boo!", UserWarning) >>> """ def __i...
I have installed numpy1.3,scipy 0.7.1,matplotlib 0.99.1.1 and python 2.5 when I import pylab I get the following error. Someone please help. /var/lib/python-support/python2.5/gtk-2.0/gtk/__init__.py:72: GtkWarning: could not open display warnings.warn(str(e), _gtk.Warning) /usr/lib/python2.5/site-packages/matplotlib/backends/...
How can I get some information about a game (Heroes of Newerth) when it's currently running (without the game api) ? For example, connections, commands, resources that game is using etc etc... I want to make something similar to a banlist on HoN, but I don't have a clue if it's possible, if it's hard or not and so on... ...
I recently saw someone with a T-shirt with some Perl code on the back. I took a photograph of it and cropped out the code: Next I tried to extract the code from the image via OCR, so I installed Tesseract OCR and the Python bindings for it, pytesser. Pytesser only works on TIFF images, so I converted the image in Gimp and entered the...
Hi, I'm trying to define a new URL handler under OSX that will point at a python script. I've wrapped the Python script up into an applet (right-clicked on the .py, and gone Open With -> Build Applet) I've added the following into the applet's Info.plist: <key>CFBundleURLTypes</key> <array> <dict> <key>CFBundleURLName</ke...
This is an example that searches PDF files in the current directory. import os, os.path import re def print_pdf (arg, dir, files): for file in files: path = os.path.join(dir, file) path = os.path.normcase(path) if re.search(r".*\.pdf", path): print path os.path.walk('.', print_pdf, 0) Could anyone explain what r".*\.pdf" m...
First of all I don't know if this is the right approach. I want to write a decorator class that will be used with methods of other class. Before running the method I'd like to check if all required class variables are initialized. The ideal case would be something similar to this: class Test(object): def __init__(self, f): s...
I would like to create a python script, which will: Create a django project in the current directory. Fix settings.py, urls.py. Do syncdb Install new apache instance listening on specific port (command line argument), with WSGI configured to serve my project. I can't figure out how to do point 3. EDIT: Peter Rowell: I need the s...
Possible Duplicate: Python == vs is comparing strings, is fails sometimes, why? In Python, what is the difference between these two statements: if x is "odp": if x == "odp": ...
I am running an xml-rpc server using SimpleXMLRPCServer from the stdlib. My code looks something like this: import SimpleXMLRPCServer import socket class RemoteStarter: def start(self): return 'foo' rs = RemoteStarter() host = socket.gethostbyaddr(socket.gethostname())[0] port = 9000 server = SimpleXMLRPCServer.SimpleXMLR...
from pack.mod import f How to get from object f information about import - 'pack.mod' I can get it using f.__module__ but if function def in module where i get this attribute (f.__module__) it return '__main__'. But i need real path here - 'pack.mod' I found this way to get this information: inspect.getmodule(f).__file__ then i ca...
Hello, for some reason I'm experiencing the Operational Error with "can't rollback" message when I attempt to roll back my transaction in the following context: try: cursors[instance].execute("lock revision, app, timeout IN SHARE MODE") cursors[instance].execute("insert into app (type, active, active_revision, contents, z) valu...
How should I import rpdb2; rpdb2.start_embedded_debugger(), but only if my Python program is not already being debugged by rpdb2? ...
Hi: Is there any reason why the position, pos, flag doesn't seem to work in the following example? dlg = wx.MessageDialog( parent=self, message='You must enter a URL', caption='Error', style=wx.OK | wx.ICON_ERROR | wx.STAY_ON_TOP, pos=(200,200) ) dlg.ShowModal() dlg.Destroy() The documentation is here: http://www...