text
stringlengths
226
34.5k
Window Icon of Exe in PyQt4 Question: I have a small program in PyQt4 and I want to compile the program into an Exe. I am using py2exe to do that. I can successfully set icon in the windows title bar using the following code, but when i compile it into exe the icon is lost and i see the default windows application. her...
Controlling VirtualBox from commandline with python Question: We are using python virtualbox API for controlling the virtualbox. For that we are using the "pyvb" package(as given in python API documentation). al=pyvb.vb.VB() m=pyvb.vm.vbVM() al.startVM(m) we have executed using the python i...
Haskell equivalent of C's __LINE__ Question: Is there a way to get line-number/traceback information in Haskell? (like C's `__LINE__` macro or Python's `traceback.extract_stack()`) That would be of use for me for writing Haskell program that generates C++ code, which would be notated with comments telling which Haske...
Django: show/log ORM sql calls from python shell Question: Using the excellent [Django-Devserver](http://github.com/dcramer/django- devserver) I'm finding all kinds of interesting and unexpected SQL calls in my code. I wanted to find where the calls are coming from, and so I'm looking for a way to get a log or print-ou...
clicking "cancel" in tkColorChooser dialog leads to Error Question: I use python 2.6 under linux (SUSE Linux Enterprise Desktop 11 (x86_64)). I tested some very simple code : import tkColorChooser tkColorChooser.askcolor() then if I click on cancel, I always get error like: Trace...
How can I disable the webbrowser message in python? Question: In my python program, when I send the user to create a gmail account by use of the webbrowser module, python displays: "Please enter your Gmail username: Created new window in existing browser session." Is there any way to get rid of "created new window in...
Python drawing on screen Question: I'm coding an application that needs to select an area of the screen. I need to change the cursor to a cross and then draw a rectangle on the user selection. The first thing I searched for is how to manipulate the cursor and I came across wxPython. With wxPython I could easily do this...
How to compute information entropy in a two-step decision? Question: I have a question which I think involves "conditional entropy" in the field of information theory. I am trying to wrap my head around it, but could use some help. Consider an example in which we have four houses. In the first house there are eight peo...
Count warnings in Python 2.4 Question: I've got some tests that need to count the number of warnings raised by a function. In Python 2.6 this is simple, using with warnings.catch_warnings(record=True) as warn: ... self.assertEquals(len(warn), 2) Unfortunately, `with` is not availabl...
Output of python scripts displayed only at termination when using SSH? Question: I'm running a script to manage processes on a remote (SSH) machine. Let's call it **five.py** #!/usr/bin/python import time, subprocess subprocess.call('echo 0',shell=True) for i in range(1,5): time.s...
In SciPy, using ix_() with sparse matrices doesn't seem to work so what else can I use? Question: In Numpy, ix_() is used to grab rows and columns of a matrix, but it doesn't seem to work with sparse matrices. For instance, this code works because it uses a dense matrix: >>> import numpy as np >>> x ...
No module named csrf Question: I have: Python 2.6 Django 1.1.1 I downloaded Django-cms from git://github.com/digi604/django-cms-2.0.git I passed south off/on I stuck on this: After enabling south syncdb returns: Synced: > django.contrib.auth > django.contrib.contenttypes > django.contrib...
PyGreSQL NULLs for integer field Question: I am trying to insert some rows into a table which has a field of integers, which can be NULL: cur.execute("INSERT INTO mytable (id, priority) VALUES (%(id)d, %(priority)d)", \ {'id': id, 'priority': priority}) The priority variable is eith...
Writing to file doesn't flush content automatically and cause out of memory in Python Question: I made simple python program to generate big text file: import sys import random f = open('data.txt', 'w') for i in range(100000000): f.write(str(i) + "\t" + str(random.randint(0,1...
Why doesn't import prevent NameError in a python script run with execfile()? Question: I looked at a number of existing questions about NameError exceptions when scripts are run with exec statements or execfile() in Python, but haven't found a good explanation yet of the following behavior. I want to make a simple gam...
Python: does the set class "leak" when items are removed, like a dict? Question: I know that Python `dict`s will "leak" when items are removed (because the item's slot will be overwritten with the magic "removed" value)… But will the `set` class behave the same way? Is it safe to keep a `set` around, adding and removin...
Building an interleaved buffer for pyopengl and numpy Question: I'm trying to batch up a bunch of vertices and texture coords in an interleaved array before sending it to pyOpengl's glInterleavedArrays/glDrawArrays. The only problem is that I'm unable to find a suitably fast enough way to append data into a numpy array...
How do I print a line following a line containing certain text in a saved file in Python? Question: I have written a Python program to find the carrier of a cell phone given the number. It downloads the source of [http://www.whitepages.com/carrier_lookup?carrier=other&number_0=1112223333&response=1](http://www.whitepag...
Parsing broken XML with lxml.etree.iterparse Question: I'm trying to parse a huge xml file with lxml in a memory efficient manner (ie streaming lazily from disk instead of loading the whole file in memory). Unfortunately, the file contains some bad ascii characters that break the default parser. The parser works if I s...
Running a python script from webpy Question: I setup a lighttpd server along with webpy and fastcgi. I am trying to simply run a python script everytime the wenpy app is accessed. Though it seems even when I give the normal python code to execute the script it does nothing. So Id like to be able to run this script, any...
Serial communication. Sending DTR in the right way? Question: I'm dealing with a [gm29](http://www.icpdas.com/products/GSM_GPRS/wireless/gm29.htm) by Sony Ericsson. The [datasheet](http://www.icpdas.com/download/wireless/gsm/gm29/gm29_tech%20description_r1b.pdf) says that plugging the power is not sufficient to switch...
Python - lexical analysis and tokenization Question: I'm looking to speed along my discovery process here quite a bit, as this is my first venture into the world of lexical analysis. Maybe this is even the wrong path. First, I'll describe my problem: I've got very large properties files (in the order of 1,000 properti...
Is there a way to specify a fixed (or variable) number of elements for lxml in Python Question: There must be an easier way to do this. I need some text from a large number of html documents. In my tests the most reliable way to find it is to look for specific word in the text_content of the div elements. If I want to ...
How to delete all blank lines in the file with the help of python? Question: For example, we have some file like that: > first line > second line > > third line And in result we have to get: > first line > second line > third line Use ONLY python Answer: import fileinput for line in fileinp...
How do I calculate percentiles with python/numpy? Question: Is there a convenient way to calculate percentiles for a sequence or single- dimensional numpy array? I am looking for something similar to Excel's percentile function. I looked in NumPy's statistics reference, and couldn't find this. All I could find is the...
Getting rid of Django IOErrors Question: I'm running a Django site (via Apache/mod_python) and I use Django's facilities to inform me and other developers about internal server errors. Sometimes errors like those appear: Traceback (most recent call last): File "/opt/webapp/externals/lib/django...
pybabel or other l10n libraries for PHP Question: [Babel or pybabel](http://babel.edgewall.org/) is an interface to the CLDR (Common Locale Data Repository) in Python. As such, it has the same 'knowledge' as PHP's i18n functions and classes (if the appropriate locales are installed on the host), but without the hassle ...
wsdl2py ComplexTypes Question: How do I add complex types to a SOAP request? I'm using WSDL2py generated requests, and trying to use the other TypeDefinitions that it made in the _*_ _types.py file (like AccountInfo, for authentication, that goes into every request). Then passing it the wsdl2py generated server, and I...
Better way to script USB device mount in Linux Question: I'm writing a python module for a device that interacts with a user supplied USB memory stick. The user can insert a USB memory stick in the device USB slot, and the device will dump data onto the memory stick without user intervention. If the device is running w...
HyperTreeList index out of range issue? Question: When i tried to run the following code. I am getting error. import wx from wx.lib.agw.hypertreelist import HyperTreeList class test(wx.Frame): def __init__(self): wx.Frame.__init__(self, None, -1, title='htl', si...
Python string decoding issue Question: I am trying to parse a CSV file containing some data, mostly numeral but with some strings - which I do not know their encoding, but I do know they are in Hebrew. Eventually I need to know the encoding so I can unicode the strings, print them, and perhaps throw them into a databa...
Python: File formatting Question: I have a for loop which references a dictionary and prints out the value associated with the key. Code is below: for i in data: if i in dict: print dict[i], How would i format the output so a new line is created every 60 characters? and with the...
Load huge data to memory using python Question: I have to load large data to the memory, and the structure is list. How can I get another approach. thanx Answer: process the data line by line, eg for line in open("file"): print "do processing of line:",line Or if you really really want to...
Linking a qtDesigner .ui file to python/pyqt? Question: So if I go into QtDesigner and build a UI, it'll be saved as a .ui file. How can I make this as a python file or use this in python? Answer: Another way to use .ui in your code is: from PyQt4 import QtCore, QtGui, uic class MyWidget(QtGui.QWid...
Does filehandle get closed automatically in Python after it goes out of scope? Question: If I do the following, does filehandle get closed automatically as it goes out of scope in Python: def read_contents(file_path): return file(file_path).read() If it doesn't, how can I write this function ...
Python nonblocking console input Question: I am trying to make a simple IRC client in Python (as kind of a project while I learn the language). I have a loop that I use to receive and parse what the IRC server sends me, but if I use `raw_input` to input stuff, it stops the loop dead in its tracks until I input somethi...
why does python.subprocess hang after proc.communicate()? Question: I've got an interactive program called `my_own_exe`. First, it prints out `alive`, then you input `S\n` and then it prints out `alive` again. Finally you input `L\n`. It does some processing and exits. However, when I call it from the following python...
how to get data from csv file in python Question: I am using csv.reader to read file but it giving me whole file. file_data = self.request.get('file_in'); file_Reader = csv.reader( file_data ); for fields in file_Reader: I want one line at a time and separate data from that line. ...
How to only pay the dependency penalty for the implementation you use in Python? Question: I have a fairly simple set of functionality for which I have multiple implementations, e.g., a datastore that could be backed by Redis, MongoDB, or PostgreSQL. How should I structure/write my code so that code that wants to use o...
Error in gui programming in python using tkinter Question: #!/usr/bin/python # -*- coding: iso-8859-1 -*- import Tkinter class simpleapp_tk(Tkinter.Tk): def __init__(self,parent): Tkinter.Tk.__init__(self,parent) self.parent=parent def initialize(self):...
Testing warnings with doctest Question: I'd like to use [doctests](http://docs.python.org/library/doctest.html) 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 gi...
OSX : Defining a new URL handler that points straight at a Python script Question: 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 appl...
Uneditable file and Unreadable(for further processing) file( WHY? ) after processing it through C++ Program Question: :) This might look to be a very long question to you I understand, but trust me on this its not long. I am not able to identify why after processing this text is not being able to be read and edited. I ...
How to look ahead one element in a Python generator? Question: I can't figure out how to look ahead one element in a Python generator. As soon as I look it's gone. Here is what I mean: gen = iter([1,2,3]) next_value = gen.next() # okay, I looked forward and see that next_value = 1 # but now: ...
Java equivalent for database schema changes like South for Django? Question: I've been working on a Django project using South to track and manage database schema changes. I'm starting a new Java project using Google Web Toolkit and wonder if there is an equivalent tool. For those who don't know, here's what South does...
How do I add my own custom attributes to existing built-in Python types? Like a string? Question: I want to do something like this... def helloWorld(): print "Hello world!" str.helloWorld = helloWorld "foo".helloWorld() Which would print out "Hello world!" EDIT: Refer to [Can I add c...
How to get the list of price offers on an item from Amazon with python-amazon-product-api item_lookup function? Question: I am trying to write a function to get a list of offers (their prices) for an item based on the ASIN: def price_offers(asin): from amazonproduct import API, ResultPaginator, A...
Change Name of Import in Java, or import two classes with the same name Question: In Python you can do a: from a import b as c How would you do this in Java, as I have two imports that are clashing. Answer: There is no import aliasing mechanism in Java. You cannot import two classes with the same...
Any way to assign terminal output to variable with python? Question: I need to grab the duration of a video file via python as part of a larger script. I know I can use ffmpeg to grab the duration, but I need to be able to save that output as a variable back in python. I thought this would work, but it's giving me a va...
decrypt excel files Question: Hi I have 1000 encrypted workbooks which I would like to decrypt by providing a pwd. I could not find a decrypt method under apache poi or python's xlrd module. Does anyone know a library which could handle this (`wbc.decrypt(pwd)`). I would prefer a lib i could you use from a unix box. ...
Normalising book titles - Python Question: I have a list of books titles: * "The Hobbit: 70th Anniversary Edition" * "The Hobbit" * "The Hobbit (Illustrated/Collector Edition)[There and Back Again]" * "The Hobbit: or, There and Back Again" * "The Hobbit: Gift Pack" and so on... * * * I thought that if I n...
Python importing Question: I have a file, `myfile.py`, which imports `Class1` from `file.py` and `file.py` contains imports to different classes in `file2.py`, `file3.py`, `file4.py`. In my `myfile.py`, can I access these classes or do I need to again import file2.py, file3.py, etc.? Does Python automatically add all...
python FancyURLopener timeout Question: is there a way to set connection timeout for FancyURLopener()? I'm using FancyURLopener.retrieve() to download a file, but sometimes it just stucks and that's all... I think this is because it's still trying to connect and it's not possible. So is there a way to set that timeout?...
Twisted: why is it that passing a deferred callback to a deferred thread makes the thread blocking all of a sudden? Question: I unsuccessfully tried using txredis (the non blocking twisted api for redis) for a persisting message queue I'm trying to set up with a scrapy project I am working on. I found that although the...
Django: CharField with fixed length, how? Question: I wold like to have in my model a CharField with fixed length. In other words I want that only a specified length is valid. I tried to do something like volumenumber = models.CharField('Volume Number', max_length=4, min_length=4) but it gives me ...
Cannot turn off autocommit in a script using the Django ORM Question: I have a command line script that uses the Django ORM and MySQL backend. I want to turn off autocommit and commit manually. For the life of me, I cannot get this to work. Here is a pared down version of the script. A row is inserted into testtable ev...
Python 'datetime.datetime' object is unsubscriptable Question: First, I am NOT a python developer. I am trying to fix an issue within a python script that is being executed from the command line. This script was written by someone who is no longer around, and no longer willing to help with issues. This is python 2.5, ...
Character encoding for US Census Cartographic Boundary Files Question: I'm trying to import the US Census cartographic boundary files (available here: <http://www.census.gov/geo/www/cob/bdy_files.html> ) into a GeoDjango application. However, python is complaining about UnicodeDecodeErrors (for example, for the non-asc...
Inconsistency in modified/created/accessed time on mac Question: I'm having trouble using `os.utime` to correctly set the modification time on the mac (Mac OS X 10.6.2, running Python 2.6.1 from `/usr/bin/python`). It's not consistent with the `touch` utility, and it's not consistent with the properties displayed in th...
Resulting .exe from PyInstaller with wxPython crashing Question: I'm trying to compile a very simple wxPython script into an executable by using PyInstaller on Windows Vista. The Python script is nothing but a Hello World in wxPython. I'm trying to get that up and running as a Windows executable before I add any of th...
python metaprogramming Question: I'm trying to archive a task which turns out to be a bit complicated since I'm not very good at Python metaprogramming. I want to have a module `locations` with function `get_location(name)`, which returns a class defined in a folder locations/ in the file with the name passed to funct...
Send an email using python script Question: Today I needed to send email from a Python script. As always I searched Google and found the following script that fits to my need. import smtplib SERVER = "localhost" FROM = "sender@example.com" TO = ["user@example.com"] # must be a list ...
Clever way of building a tag cloud? - Python Question: I've built a content aggregator and would like to add a tag cloud representing the current trends. Unfortunately this is quite complex, as I have to look for **keywords** that represent the context of each article. For example words such as **I** , **was** , **th...
python parallel computing: split keyspace to give each node a range to work on Question: My question is rather complicated for me to explain, as i'm not really good at maths, but i'll try to be as clear as possible. I'm trying to code a cluster in python, which will generate words given a charset (i.e. with lowercase:...
how to do asynchronous http requests with epoll and python 3.1 Question: **UPDATE: after much laboring with Py3, including writing my own asynchronous webserver (following a presentation given by Dave Beazley), i finally dumped Python (and a huge stack of my code )-: in favor of[CoffeeScript](http://coffeescript.org/) ...
How do I introspect things in Ruby? Question: For instance, in Python, I can do things like this if I want to get all attributes on an object: >>> import sys >>> dir(sys) ['__displayhook__', '__doc__', '__excepthook__', '__name__', '__package__', '__stderr__', '__stdin__', '__stdout__', '_clear_t...
Trying to grab just absolute links from a webpage using BeautifulSoup Question: I am reading the contents of a webpage using BeautifulSoup. What I want is to just grab the `<a href>` that start with `http://`. I know in beautifulsoup you can search by the attributes. I guess I am just having a syntax issue. I would ima...
Having trouble scraping an ASP .NET web page Question: I am trying to scrape an ASP.NET website but am having trouble getting the results from a post. I have the following python code and am using httplib2 and BeautifulSoup: conn = Http() # do a get first to retrieve important values page = conn....
A 3-D grid of regularly spaced points Question: I want to create a list containing the 3-D coords of a grid of regularly spaced points, each as a 3-element tuple. I'm looking for advice on the most efficient way to do this. In C++ for instance, I simply loop over three nested loops, one for each coordinate. In Matlab,...
Spikes in Socket Performance Question: We are facing random spikes in high throughput transaction processing system using sockets for IPC. Below is the setup used for the run: 1. The client opens and closes new connection for every transaction, and there are 4 exchanges between the server and the client. 2. We ha...
Python Permutation Program Flow help Question: i found this code at activestate, it takes a string and prints permutations of the string. I understand that its a recursive function but i dont really understand how it works, it'd be great if someone could walk me through the program flow, thanks a bunch! ...
How to replace openSSL calls with C# code? Question: Hey there again! Today I ran into a problem when I was making a new theme creator for chrome. As you may know, Chrome uses a "new" file format, called CRX, to manage it's plugins and themes. It is a basic zip file, but a bit modified: "Cr24" + derkey + signature + z...
python MySQLdb got invalid syntax when trying to INSERT INTO table Question: ## COMMENT OUT below just for reference "" cursor.execute (""" CREATE TABLE yellowpages ( business_id BIGINT(20) NOT NULL AUTO_INCREMENT, categories_name VARCHAR(255), busine...
Proper way to reload a python module from the console Question: I'm debugging from the python console and would like to reload a module every time I make a change so I don't have to exit the console and re-enter it. I'm doing: >>> from project.model.user import * >>> reload(user) but I receive:...
python: list modules within the package Question: I have a package with a few modules, each module has a class (or a few classes) defined within it. I need to get the list of all modules within the package. Is there an API for this in python? Here is the file structure: \pkg\ \pkg\__init__.py \p...
Sunrise / set calculations Question: I'm trying to calculate the sunset / rise times using python based on the link provided below. My results done through excel and python do not match the real values. Any ideas on what I could be doing wrong? My Excel sheet can be found under .. <http://transpotools.com/sun_time.xl...
Tell if a given login exists in Linux using Python Question: In Python under Linux, what is the easiest way to check the existence of a user, given his/her login? Anything better than issuing 'ls ~login-name' and checking the exit code? And if running under Windows? Answer: This answer builds upon the [answer by Br...
Python-daemon doesn't kill its kids Question: When using [python-daemon](http://pypi.python.org/pypi/python-daemon/), I'm creating subprocesses likeso: import multiprocessing class Worker(multiprocessing.Process): def __init__(self, queue): self.queue = queue # we wait for thing...
python mechanize.browser submit() related problem Question: im making some script with mechanize.browser module. one of problem is all other thing is ok, but when submit() form,it not working, so i was found some suspicion source part. in the html source i was found such like following. <form method="...
Any way to add my C# project as a reference in IronPython / IronRuby? Question: I know how to reference an existing .dll to IronPython, but is there any way to add my project as a reference like I can between Visual Studio projects? Or is it best practice to create a separate class library? Answer: You can't add ref...
python mongokit Connection() AssertionError Question: just installed mongokit and can't figure out why I get AssertionError python console: >>> from mongokit import Connection >>> c = Connection() Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local...
What to put in a python module docstring? Question: Ok, so I've read both [PEP 8](http://www.python.org/dev/peps/pep-0008/) and [PEP 257](http://www.python.org/dev/peps/pep-0257/), and I've written lots of docstrings for functions and classes, but I'm a little unsure about what should go in a module docstring. I figure...
Heavy usage of Python at Google Question: Google's heavy usage of Python, is it just a matter of taste or does it give them a competitive advantage? Answer: I can't really give a definitive answer, because by the time I interviewed at Google in 2004 Python was already prominent at Google. Indeed, there's one apparen...
No module named difflib Question: I want to execute python code from C# with following code. static void Main(string[] args) { ScriptEngine engine = Python.CreateEngine(); ScriptSource source = engine.CreateScriptSourceFromFile(@"F:\Script\extracter.py"); so...
How to make a simple cross-platform webbrowser with Python? Question: The <http://code.google.com/p/pywebkitgtk/> looks great but it seems to be running on linux only. Does anybody know if there is something similar but cross-platform? If not what can be the alternatives to make with Python a simple web-browser that ...
(Python) algorithm to randomly select a key based on proportionality/weight Question: I'm a bit at a loss as to how to find a clean algorithm for doing the following: Suppose I have a dict k: >>> k = {'A': 68, 'B': 62, 'C': 47, 'D': 16, 'E': 81} I now want to randomly select one of these keys, bas...
Using CookieJar in Python to log in to a website from "Google App Engine". What's wrong here? Question: I've been trying to find a python code that would log in to my mail box on yahoo.com from ["Google App Engine"](http://code.google.com/intl/en/appengine/docs/whatisgoogleappengine.html) . [Here (click here to see tha...
Sorting a list of dot sparated numbers, like software versions Question: I have a list containing version strings, such as things: versions_list = ["1.1.2", "1.0.0", "1.3.3", "1.0.12", "1.0.2"] I would like to sort it, so the result would be something like this: versions_list = ["1.0...
wxWidgets/wxPython: Do two identical events cause two handlings? Question: When there are two identical events in the event loop, will wxPython handle both of them, or will it call the handler only once for them both? I mean, in my widget I want to have an event like `EVT_NEED_TO_RECALCULATE_X`. I want this event to b...
Python lookup hostname from IP with 1 second timeout Question: How can I look up a hostname given an IP address? Furthermore, how can I specify a timeout in case no such reverse DNS entry exists? Trying to keep things as fast as possible. Or is there a better way? Thank you! Answer: >>> import socket >>> soc...
How can I include custom modules in a Django app Question: I'm really new to Python and Django. I created a class in Python that I would like to use in a Django application. It doesn't seem like it belongs in it's own application, how can I include it in my django app? Thank you! Answer: Put it [in a module somewher...
Do alternate python implementation version numbers imply that they provide the same syntax? Question: for example Jython is at version 2.5.1, does that imply a parallel fidelity to cpython syntax when it was at version 2.5.1? Answer: Generally yes, but there's technically nothing stopping alternate implementations fr...
Handling import errors when using doctest Question: every now and then when I code in Python, I have to do without certain third- party modules. Eg. when I'm writing user authentication, it can be done in several ways and one of them is by using LDAP. However if the user does not want to use LDAP auth., he can choose ...
python: can't terminate a thread hung in socket.recvfrom() call Question: I cannot get a way to terminate a thread that is hung in a socket.recvfrom() call. For example, ctrl+c that should trigger KeyboardInterrupt exception can't be caught. Here is a script I've used for testing: from socket import * ...
float change from python 3.0.1 to 3.1.2 Question: I'm trying to learn python. I am using 3.1.2 and the o'reilly book is using 3.0.1 here is my code: import urllib.request price = (99.99) while price > 4.74: page = urllib.request.urlopen ("http://www.beans-r-us.biz/prices-loyalty...
Python Ephem / Datetime calculation Question: the output should process the first date as "day" and second as "night". I've been playing with this for a few hours now and can't figure out what I'm doing wrong. Any ideas? **Edit** I assume that the problem is due to my date comparison implementation **Output:** ...
How can I remove all words that end in ":" from a string in Python? Question: I'm wondering how to remove a dynamic word from a string within Python. It will always have a ":" at the end of the word, and sometimes there's more than one within the string. I'd like to remove all occurrences of "word:". Thanks! :-) An...
MySQLdb not INSERTING, _mysql does fine Question: Okay, I log onto the MySQL command-line client as root. I then open or otherwise run a python app using the MySQLdb module as root. When I check the results using python (IDLE), everything looks fine. When I use the MySQL command-line client, no INSERT has occurred. If ...
Non-ASCII character Syntax Error in Python while calling URL Question: How can data can be sent to the server? For example, I have retrieve MAC address, so I want send to the server (e.g. <http://211.21.24.43:8080/data?mac=00-0C-F1-56-98-AD>) I found this snippet on the Internet: from urllib2 import Re...
Scope of "library" methods Question: I'm apparently laboring under a poor understanding of Python scoping. Perhaps you can help. Background: I'm using the if __name__ == "__main__" construct to perform "self-tests" in my module(s). Each self test makes calls to the various public methods and pri...