How can I find what directory a module has been imported from, as it needs to load a data file which is in the same directory.
edit:
combining several answers:
module_path = os.path.dirname(imp.find_module(self.__module__)[1])
got me what i wanted
...
Hello, I have module GUI, which has JTRee. And 2nd module creates ArrayLists of my own defined objects, which have some structure.
For example car = new Car();
car.addEngine(new Engine("eng"));
car.getEngine("eng").addWheel(new Wheel());
How to do my JTree in GUI module listens creating of objects in 2nd module and adding it to JTree?
...
Hello,
I am using Netbeans 6.8 and Glassfish v3.0.
I created an ejb module and created entity classes from database and then created stateless session bean with remote interface. Say eg.
@Remote
public interface customerRemote{
public void add(String name, String address);
public Customer find(Integer id);
}
@Stateless
pub...
I compiled a simple hello world C module for Python and it works correctly in everything I've tried but IDLE. Here's what I type to test it:
>>> import hello
>>> hello.say_hello('Justin')
I have tried this using Python from the command prompt(I'm using Windows), in Eclipse's PyDev, and with PieDream and they all print out Hello Justin...
I need to import the multiprocessing module in Python 2.5.
I've followed the instructions here exactly: http://code.google.com/p/python-multiprocessing/wiki/Install
make and make test run without errors. I've also edited $PYTHONPATH to include the directory where the package is installed.
But 'import multiprocessing' still says: "Imp...
Hello! When I installed perl from the source the first nice surprise was that without doing something all module installed from now on were available to the new perl. Since I didn't find one module on cpan that comes with my OS I have to use for some scripts the onboard-perl. For one of these scripts I would like to install Text::Format ...
Similar to how Ruby has rubygems where you can do gem install packagename?
On http://docs.python.org/install/index.html, i only see references to python setup.py install but that requires you to find the package first.
...
i used zend_tool to setup a project then to create module blog with index controller etc but i guess the default config setup by zend_tool does not work with modules so i edited it
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
resources.frontController.moduleDirectoryControllerName = "controllers"
i guess th...
I am using reccomended app. structure ( http://framework.zend.com/manual/1.10/en/project-structure.filesystem.html ) in Zend Framework but I cant get each module config working.
It just doesn't load modules/mymodule/configs/application.ini file into configuration.
...
How can implement the equivalent of a __getattr__ on a class, on a module?
Example
When calling a function that does not exist in a module's statically defined attributes, I wish to create an instance of a class in that module, and invoke the method on it with the same name as failed in the attribute lookup on the module.
class A(obje...
hello all
i have a module "B", i want to run it from a script "C",
and i want to call global variables in "B", as they wer in "C" root, another problem that is if i imported sys in "B" when i run "C" it doesnt see sys
# NameError: global name 'sys' is not defined #
what shall i do?
...
Hi all,
as the old ISAPI filters are going to die sooner or later, I want to rewrite an old ISAPI filter that was used in IIS 6 into a module for use in IIS 7. The module will be used globally, meaning it will be used within each site, on a Windows Server 2008 R2 with IIS 7.5 installed, that will host several thousand web sites and manag...
Hello, I have followed the basic GWT tutorial for creating a project in Eclipse. Now, I am trying to build off what I learned in the tutorial. I created a static utility class to perform some database connection logic. However, when I try to compile I get:
[ERROR] Line 46: No source code is available for type com.sample.server.Connec...
Hey there,
I've been using the Zend Framework to map subdomain requests to a module in my main MVC application but now I need to change the virtual host config back and use a htaccess file instead. Previously all I needed to do in the virtual host config was to set the subdomain DocumentRoot to be the document root of the main applicati...
Is there a Python way without using a subprocess to clone a git repository? I'm up for using any sort of modules you recommend.
...
I’ve built a site in ExpressionEngine for some holiday apartments (EE1.6.8), that uses two related weblogs for bookings.
‘apartments’ & ‘booking’
Bookings are set up as weblog entries using the entry_date for arrival and expiration_date for leaving date, and are related back to the apartment that is booked.
I’ve built a page that list...
We have numerous projects in our organization that are mixed Python/C. Currently we're trying to standardize on a directory layout for our projects and are trying to come up with a convenient scheme. One point of contention is where to put C extension modules in the tree.
We're tossing around a couple of options (relative to project roo...
I'm working on a module that, among other things, will add some generic 'finder' type functionality to the class you mix it into. The problem: for reasons of convenience and aesthetics, I want to include some functionality outside the class, in the same scope as the class itself.
For example:
class User
include MyMagicMixin
end
# S...
Hi my problem with Zend Framework...
unfortunately not solved after 3 hours of searching:
I have a modular Zend Application, which is working fine if i have my module and error templates in the called module.
If i delete error/error.phtml out of views/scripts/ a Fatal Error is showing up that there is no directory.
To cut a long story ...
Tell why you think Python, Perl, Ruby, etc is easiest for plugging in modules from other languages with minimal thought.
To clarify, an example: I want to write business logic in Python, but use functionality that conveniently exists as a Perl module.
In other words, which language "just works" with the most modules?
...