Skip to content

Instantly share code, notes, and snippets.

@BishopGIS
Created March 30, 2020 22:03
Show Gist options
  • Save BishopGIS/b5e37e7e068d98109b0352dc9932bd63 to your computer and use it in GitHub Desktop.
Save BishopGIS/b5e37e7e068d98109b0352dc9932bd63 to your computer and use it in GitHub Desktop.
test numpy exists
import sys
import os
for path_item in sys.path:
try:
items = os.listdir(path_item)
for item in items:
if item == 'numpy':
print('numpy directory present in path: {}'.format(path_item))
# cut some lines from __init__.py
full_path = os.path.join(path_item, item, '__init__.py')
with open(full_path) as f:
for i in range(155):
if i < 150:
qq = f.next()
continue
else:
print(f.next())
except:
pass
print('finished')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment