import ABC loads ABC from somewhere. How can I know the 'somewhere'?
I may be able to check the paths in sys.path one by one, but I wonder if I can find it in Python.
More Questions
When I load library with 'from ABC import *', how can I know where ABC is located?
Can 'class xyz' know where it is located when it is called?
...
I'm trying to make a simple IRC bot that also listens to another port for incoming data and relays that to an IRC channel.. I'm using the following as sample code for my bot
http://www.eflorenzano.com/blog/post/writing-markov-chain-irc-bot-twisted-and-python/
I'm getting stuck how I also add a listenTCP to be able to talk to the bot wi...
so I have 2 classes
this one:
class updateForm(forms.Form):
address = forms.CharField(
max_length = 255,
label = 'Home Address',
)
cnp = forms.CharField(
max_length = 15,
label = 'CNP',
...
Background
To capture data from a logic controller, I'm using screen as a terminal emulator and connecting my MacBook via the KeySpan USA-19HS USB Serial Adapter. I've created the following bash script, so that I can type talk2controller <filename> where filename is the name of the data file.
#!/bin/bash
if [ -z "$1" ]; then
echo P...
Is there a standard body or a specific normative way how time-related things should be implemented in practice (like ICU for Unicode-related tasks) or is this currently a "best-effort", depending on how much effort, time and money language and library implementers want to spend?
Is there a specific and complete implementation which coul...
In SO question 3692928, I showed how I compiled and installed matplotlib in a virtualenv. One thing I did was suboptimal though—I manually set the basedirlist in setup.cfg and PREFIX in make.osx.
setup.cfg
[directories]
basedirlist = /Users/matthew/.virtualenvs/matplotlib-test
make.osx
PREFIX=/Users/matthew/.virtualenvs/matplotlib-t...
Title says it pretty much all...
I'm trying to automate tests on a web application with Windmill, and some of the test need to use forms with input type="file". I know it is not possible to manipulate this with js, but I'm wondering if the Python API of windmill allows this. I could not find anything in the docs, though, nor in the exam...
Hello!
I write the simple example with gtk.FileChooserDialog. It works fine, but there is one problem under WIndows: I see '\' in first button instead of real drive names, such as 'C:\', 'D:\' and so on. I explored FileChooserDialog structure and tried to change '\' by real drive name, but it works unstable. Can anybody help me?
import ...
Both the Python logging module and CherryPy's Config API use ConfigParser files. Therefore, I assumed that I could use one single config file for my own applications configuration, it's logging configuration, and CherryPy's configuration.
When my logging and CherryPy were separate, they worked fine, and my config file does parse with n...
I have a Sqlite 3 and/or MySQL table named "clients"..
Using python 2.6, How do I create a csv file named Clients100914.csv with headers?
excel dialect...
The Sql execute: select * only gives table data, but I would like complete table with headers.
How do I create a record set to get table headers. The table headers should come dir...
I'm finding it very difficult to develop with PyClips, because it appears to replace useful error messages thrown by Clips with a generic "syntax error" message. This makes debugging very laborious and practically impossible on large codebases when using PyClips.
Consider the following example. I wrote a very large expression, which con...
Hi All,
In my application i have text control.
I want my text ctrl should be read only but when some one right click on this he is able to copy the value from that ctrl and he can paste that value in other text control.
If i made my text control read only with wx.TE_READONLY then copy/paste is not working.
Is there any requirement to ...
test = ["a","b","c","d","e"]
def xuniqueCombinations(items, n):
if n==0: yield []
else:
for i in xrange(len(items)-n+1):
for cc in xuniqueCombinations(items[i+1:],n-1):
yield [items[i]]+cc
x = xuniqueCombinations(test, 3)
print x
outputs
"generator object xuniqueCombinations at 0x020EBFA8"...
hi,
i wanted to know in python how can i get the host the user came from?
how do i extract it?
i tried this:
host = self.request._environ['HTTP_HOST']
but it's empty...
Do you have any idea what it should be
Thanks.
...
I need to get the caller info (what file/what line) from callee. I learned that I can use inpect module for that for purposes, but not exactly how.
How to get those info with inspect? Or is there any other way to get the info?
import inspect
print __file__
c=inspect.currentframe()
print c.f_lineno
def hello():
print inspect.stack...
Hello,
I have the following multi-table inheritance situation:
from django.db import Models
class Partner(models.Model):
# this model contains common data for companies and persons
code = models.CharField()
name = models.CharField()
class Person(Partner):
# some person-specific data
ssn = models.CharField()
cla...
I was attempting to mess with the style of a Button, and noticed that my changes were making the button look strange. To make sure I was doing the right thing, I tried doing what I thought would be semantically a no-op:
button.set_style(button.get_style())
However, the button style changes dramatically after this line. I'm on Windows ...
What's the best way to indicate on a GTK interface that a button should be pressed / to "highlight" the button? The use case is that I have a set of checkboxes representing various settings, but for them to take effect, they must be submitted to a server. I want to indicate that the currently checked settings have not been sent to the se...
How do i assign a numerical value to each uppercase letter, and then use it later via string and then add up the values.
EG.
A = 1, B = 2, C = 3 (etc..)
string = 'ABC'
Then return the answer 6 (in this case).
...
I have several excel files that use lots of comments for saving information.
For example, one cell has value 2 and there is a comment attached to the cell saying
"2008:2#2009:4". it seems that value 2 is for the current year (2010) value. The comment keeps all previous year values separated by '#'. I would like to create a dictionary to...