|
Is there any way to import all modules in the current directory, and return a list of them?
For example, for the directory with:
mod.py mod2.py mod3.py It will give you [<module 'mod'>, <module 'mod2'>, <module 'mod3'>]
Started by Jeffrey Aylesworth on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
To import the modules,this should work for i foo: eval("import " + i).
|
|
I have a Python script that uses built-in modules but also imports a number of custom modules that exist in the same directory as the main script itself.
For example, I would call
python agent.py
and agent.py has a number of imports, including:
import...
Started by DavidM on
, 7 posts
by 7 people.
Answer Snippets (Read the full thread at stackoverflow):
Actually your....
Notice that the script directory is inserted before .
Install your modules in lib/site-packages to search modules in the current directory first.
Create .pth files in your lib/site-packages directory.
|
|
I have set
makepl_arg [INSTALLDIRS=site PREFIX=~/perl] mbuildpl_arg [--install_base ~/perl]
in the CPAN.pm configuration. I had hoped that this would cause modules to get installed in the same place, but I still have to set multiple paths in PERL5LIB:...
Started by Chas. Owens on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
Tell it to install everything....
Have you tried using INSTALL_BASE for both? You have to set multiple directories because you're telling CPAN.pm to install in multiple directories.
It will handle all the configuration for you.
Install local::lib.
|
Ask your Facebook Friends
|
Assume I downloaded Date::Calc from http://guest.engelschall.com/~sb/download/ .
Now, I have a script, xxx.pl , which resides in the same directory as the untar-ed "thing" that I downloaded from the link above When untar-ed, it creates a "Date-Calc-5....
Started by biznez on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
Or use the statement: use lib "path" to be able to load modules via additional use statements;
Please switch out....
In your @INC statement, specify the directory containing your Perl modules.
First need to install the module .
|
|
What's the shortest way to import a module from a distant, relative directory?
We've been using this code which isn't too bad except your current working directory has to be the same as the directory as this code's or the relative path breaks, which can...
Started by Jon-Eric on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
Put the directory in .pth files in your explained in a comment why you....
This is a per-individual-person setting, so you can manage to have multiple versions of the codebase this way .
The directory in your PYTHONPATH environment variable.
|
|
I wrote some modules, and trying to run them. How I tell where to take the module from?
I am writing in Windows, and tried to put it in c:\perl\lib but it didn't help.
Can I put it in the same directory, as the file that calls the module?
Started by Night Walker on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
(This @INC list is compiled ), but you can easily tell it to add another... .
(.pm files)
If you:
perl -e 'print join "\n", @INC;'
you'll see what paths are currently being searched for modules.
Perl uses the paths in:
@INC
to search for modules.
|
|
I have a multi-module Maven project with a parent project P and three sub-modules A, B, and C. Both B and C are war projects and both depend on A. I can type "mvn compile" in P and have all of the sub-modules properly compiled. The problem comes when ...
Started by Brian Ferris on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
modules will be installed in your computer's Maven repository, if there are no changes you just.
|
|
The only thing I can get python omnicomplete to work with are system modules. I get nothing for help with modules in my site-packages or modules that I'm currently working on.
Started by andrew on
, 7 posts
by 7 people.
Answer Snippets (Read the full thread at stackoverflow):
Both times I was able to get guessing that the omnicomplete... .
I'm (mymodule.py), I puth in a directory in PYTHONPATH, and then in site-packages.
I get completion for my own modules in my PYTHONPATH or site-packages.
Of the functions for os.path.
|
|
I need to use some CPAN modules in my application. If the person who will use my application doesn't like to install the required CPAN modules by himself, or it is not allowed to install modules, how should I handle that?
Started by Haiyuan Zhang on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
Or, you can copy the module's installation to your app's specific directory.
You can use PAR::Packer to create an executable bundle that contains all the CPAN modules your app needs to run.
|
|
Hi All,
Trying to find out if there any good modules which allow constant monitoring of a directory and as soon as a new file is in there, a number of functions are intiated?
Also actions should not be done on partly transfered files which are coming ...
Started by Issy on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Have a look at inotify code in mercurial a look at pyinotify or gamin , but I have ... .
Which OS are you running?
(disclaimer: I'm maintaining those two modules)
On Linux, you can use inotify .
You are looking for file system events modules.
|