I tried to install beautifulsoup. I get such an error:
<-- snip -->
raise MissingSectionHeaderError(fpname, lineno, line)
ConfigParser.MissingSectionHeaderError: File contains no section headers.
file: /Users/Sam/.pydistutils.cfg, line: 1
'install_lib = ~/Library/Python/$py_version_short/site-packages\n'
I get an similar error as I run ...
module Superpower
# instance method
def turn_invisible
...
end
# module method
def Superpower.turn_into_toad
...
end
module Fly
def flap_wings
...
end
end
end
Class Superman
include Superpower
...
def run_away
# how to call flap_wings?
# how to call tur...
Hello!
I have written a small Perl script and now I would like to create a test suite for it. I thought it would be nice to be able to use the script as a module, import the subs defined in the script and test these. Is there a way to have the script both standalone Perl script and Perl module? (I do not want to split the script into a ...
Has anyone tried to dynamically select which properties they want to write to an entity on appengine? For example:
I have a web form with 5 fields, and any given user will fill out some subset of those fields. I POST only the fields with data to the server (e.g. Fields 1,2,4). On the server side, how do I elegantly write only properties...
I have an ISAPI filter for IIS 6 which does some custom processing using the bytes-sent field of the response. I'd like to update that for IIS 7, but I'm running into a problem. None of the IIS 7 events seem to have access to the content-length, bytes sent, or any data which would let me calculate the content-length or bytes sent. (I k...
Is there a straightforward way to list the names of all modules in a package, without using __all__?
For example, given this package:
/testpkg
/testpkg/__init__.py
/testpkg/modulea.py
/testpkg/moduleb.py
I'm wondering if there is a standard or built-in way to do something like this:
>>> package_contents("testpkg")
['modulea', 'modul...
I have the following code in .py file:
import re
regex = re.compile(
r"""ULLAT:\ (?P<ullat>-?[\d.]+).*?
ULLON:\ (?P<ullon>-?[\d.]+).*?
LRLAT:\ (?P<lrlat>-?[\d.]+)""", re.DOTALL|re.VERBOSE)
I have the data in .txt file as a sequence:
QUADNAME: rockport_colony_SD
RESOLUTION: 10 ULLAT: 43.625 ULLON:
-97.87527466 LRLAT: 43.5...
I have a sequence of x, y and z -coordinates, which I need to manipulate. They are in one list of three tuples, like {(x1, y1, z1), (x2, y2, z2), ...}.
I need addition, multiplication and logarithm to manipulate my data.
I would like to study a module, which is as powerful as Awk -language.
...
I am just writing a test file and then i am trying to call a function inside my kernel.
Can somebody tell if i am making a mistake in my makefile or my code??
I wanted to call my int d = add(2, 4); function but the program does not seem to link test.c file with sourceadd2.c.
/* sourceadd2.c */
define KERNEL
define MODULE
include "t...
I recently started using the module MooseX::Declare. I love it for its syntax. It's elegant and neat. Has anyone come across cases where you would want to write many functions (some of them big) inside a class and the class definition running into pages? Is there any workaround to make the class definition to just have the functions decl...
From my experience, one of the bigger problems we come across during our webdevelopment process is keeping different setups updated and secure across different servers.
My company has it's own CMS which is currently installed across 100+ servers. At the moment, we use a hack-ish FTP-based approach, combined with upgrade scripts at spec...
The docs (Exporter and perlmodlib) say:
As a general rule, if the module is
trying to be object oriented then
export nothing.
But then perlmodlib also says:
Standard, bundled modules are all
expected to behave in a well-defined
manner with respect to namespace
pollution because they use the
Exporter module.
So I w...
Hi everyone,
I'm working on my first significant Python project and I'm having trouble with scope issues and executing code in included files. Previously my experience is with PHP.
What I would like to do is have one single file that sets up a number of configuration variables, which would then be used throughout the code. Also, I wan...
To tailor your scripts toward mp2, avoiding the need for any compatibility wrappers and such, it's said that you're supposed to declare variables using "local our" rather than "my". What about in modules?
sub new
{
local our $type = shift;
local our $self = {};
bless $self, $type;
}
Is that right? Or should it be 'my' so...
I'm trying to do a modular application, and I'm having a problem because I have two modules, where one of them depends on the other.
For example: module 1 has a class that imports classes from module 2.
I've put the following line in my Manifest.txt of module 1:
Class-Path: modulo_2.jar
... but I'm getting a error when I create the...
How do you write a module for Perl? In Python you can use:
# module.py
def helloworld(name):
print "Hello, %s" % name
# main.py
import module
module.helloworld("Jim")
...
Here's what I want to do: I want to build a test suite that's organized into packages like tests.ui, tests.text, tests.fileio, etc. In each __init__.py in these packages, I want to make a test suite consisting of all the tests in all the modules in that package. Of course, getting all the tests can be done with unittest.TestLoader, bu...
I am confused how directory name, file name and class name all work together.
This is what I have at the moment
app.py
database/
client.py
staff.py
order.py
inside client.py I have a single class called client. This class acts as the database model (MVC), the same with my other files (staff.py has a class called st...
I have a set of statically-compiled libraries, with fairly deep-running dependencies between the libraries. For example, the executable X uses libraries A and B, A uses library C, and B uses libraries C and D:
X -> A
A -> C
X -> B
B -> C
B -> D
When I link X with A and B, I don't want to get errors if C and D were not a...
I have a module that uses ctypes to wrap some functionality from a static library into a class. When the module loads, it calls an initialize function in the static library. When the module is unloaded (presumably when the interpreter exits), there's an unload function in the library that I'd like to be called. How can I create this hook...