473,387 Members | 1,798 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How to find imported modules

My Main program imports several other smaller programs.
for example
Main.py
imports
Program1.py
Program2.py
....
Program50.py

Now I need to find out which of Programs imports a particular module
- module timesocket.py
Is that possible without opening each program?
Thanks
B.

Oct 16 '07 #1
2 1418
On Oct 16, 3:46 pm, Johny <pyt...@hope.czwrote:
My Main program imports several other smaller programs.
for example
Main.py
imports
Program1.py
Program2.py
...
Program50.py

Now I need to find out which of Programs imports a particular module
- module timesocket.py
Is that possible without opening each program?
Thanks
B.
It is with grep on *nix, or you could download baregrep for windows,
which is what I use when I need to know this sort of thing.

Mike

Oct 16 '07 #2
En Tue, 16 Oct 2007 17:50:06 -0300, <ky******@gmail.comescribió:
On Oct 16, 3:46 pm, Johny <pyt...@hope.czwrote:
>Now I need to find out which of Programs imports a particular module
- module timesocket.py
Is that possible without opening each program?

It is with grep on *nix, or you could download baregrep for windows,
which is what I use when I need to know this sort of thing.
On Windows there is no need to download anything, you can use the findstr
utility:

findstr /R /S /C:"import *timesocket" /C:"from *timesocket *import" *.py

--
Gabriel Genellina

Oct 17 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Berteun Damman | last post by:
Hello, First I was trying to get PyOSD, but as soon as I did `import pyosd' Python received a SIGABRT. Then I wrote my own module, which looks like: #include <Python.h> static PyMethodDef...
4
by: Andreas Neudecker | last post by:
Hi. I know you can read the filename of a program as sys.argv. But what about modules? Is there a similar way to find out the file name of a module (called by some other module or program) from...
3
by: Jason | last post by:
Hi, I've been having trouble understanding the difference between global namespace within and between modules. For example, I can program a subthread to see a global name (a threaded event to...
2
by: Casey Hawthorne | last post by:
Is there a way to determine -- when parsing -- if a word contains a builtin name or other imported system module name? Like "iskeyword" determines if a word is a keyword! -- Regards, Casey
3
by: Zachary Pincus | last post by:
Hi folks, I'm sure this has come up before, but the search terms I've been using are so non-specific that I can't get any traction on Google. Here's my question: I have written a subclass of...
3
by: schpok | last post by:
When I "from foo import *" in my __init__.py, sometimes module foo's docs will be expanded in the pydocs. It seems to depend in what language foo was implemented. For example, if you "from math...
3
by: Mohamed Yousef | last post by:
Hello , The problem I'm asking about is how can imported modules be aware of other imported modules so they don't have to re-import them (avoiding importing problems and Consicing code and...
0
by: Mohamed Yousef | last post by:
Hello , The problem I'm asking about is how can imported modules be aware of other imported modules so they don't have to re-import them (avoiding importing problems and Consicing code and...
0
by: Terry Reedy | last post by:
Mohamed Yousef wrote: If you want to use module A in both B and C, B and C should both import A. No problem. ??
4
by: Mohamed Yousef | last post by:
On Sun, Aug 24, 2008 at 9:59 AM, Fredrik Lundh <fredrik@pythonware.comwrote: why isn't it a good thing (even if optional) consider the sitution in which a utility module is used every where else -...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.