473,401 Members | 2,068 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,401 software developers and data experts.

Finding a lost PYTHONPATH with find

OK, this is really a reminder to myself next time I forget where I set
my PYTHONPATH and forget exactly how to invoke the GNU "find" command
;-)

Hope somebody else finds it useful too

find / -maxdepth 3 -size -100k -type f -exec grep -sli pythonpath '{}' \;
The minus in '-100k' (meaning "less than 100k") seems to be
undocumented, at least on my system. I suppose the -maxdepth is
redundant since I think find searches breadth-first by default.

The file I was looking for turned out to be in /etc/profile.d/, whose
existence I completely forgot about...
John
May 28 '06 #1
2 1534
John J. Lee wrote:
find / -maxdepth 3 -size -100k -type f -exec grep -sli pythonpath '{}' \;
The minus in '-100k' (meaning "less than 100k") seems to be
undocumented, at least on my system.
It should be standard in linux man pages, can't speak for other unices:

TESTS
Numeric arguments can be specified as

+n for greater than n,

-n for less than n,

n for exactly n.

Maybe you were fooled because it's not directly under the description of
-size.

I suppose the -maxdepth is
redundant since I think find searches breadth-first by default.


??? maxdepth determines how deep the search will look, not the order the
search occurs. Your search only find things within 3 levels of the root,
unless your directory tree goes no deeper than that (very unlikely) the
maxdepth can't be redundant.

--
Edward Elliott
UC Berkeley School of Law (Boalt Hall)
complangpython at eddeye dot net
May 29 '06 #2
Edward Elliott <no****@127.0.0.1> writes:
John J. Lee wrote:
find / -maxdepth 3 -size -100k -type f -exec grep -sli pythonpath '{}' \;
The minus in '-100k' (meaning "less than 100k") seems to be
undocumented, at least on my system.


It should be standard in linux man pages, can't speak for other unices:

TESTS
Numeric arguments can be specified as

+n for greater than n,

-n for less than n,

n for exactly n.

Maybe you were fooled because it's not directly under the description of
-size.


Yes, that's right -- thanks.

I suppose the -maxdepth is
redundant since I think find searches breadth-first by default.


??? maxdepth determines how deep the search will look, not the order the
search occurs. Your search only find things within 3 levels of the root,
unless your directory tree goes no deeper than that (very unlikely) the
maxdepth can't be redundant.


It can if you hit Control-C as soon as it finds the damn thing :-) --
which is exactly what I would have done, of course.
John

Jun 1 '06 #3

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

Similar topics

2
by: Eric Wichterich | last post by:
Hello Pythonistas, I am trying to get certain (self-written) libraries imported into my scripts using statements like "from library import function.py". But they are not being found. I...
8
by: Tero Pihlajakoski | last post by:
Hi, I've been experimenting on embedding Python to a C software, and ran into a little problem with PYTHONPATH (I'm running on linux). Here's the deal: When trying to call...
0
by: Michael Yanowitz | last post by:
Hello: Someone on my team tried out installing my Python code and found that setting PYTHONPATH does not work, but setting PATH environment variable works the way PYTHONPATH should. Is that how...
3
by: james | last post by:
Hi all, I recently updated os x from python 2.4 to 2.5 (from python.org) and in doing so I lost my old python path entries. Python 2.4 was installed using fink. Now when I do: import sys...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.