Skip to content

Commit

Permalink
Merge pull request #164 from jabreity/patch-1
Browse files Browse the repository at this point in the history
Update scan-and-livemon
  • Loading branch information
Oros42 authored Jul 9, 2024
2 parents 46af976 + be58490 commit e50439a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,14 @@ sudo ldconfig
echo 'export PYTHONPATH=/usr/local/lib/python3/dist-packages/:$PYTHONPATH' >> ~/.bashrc
```

### Importlib vs Imp
Beginning with Python 3.1, Imp is replaced by importlib. Imp is deprecated in Python 3.11, with the new requirements met as follows.

```bash
apt install python3-pip
pip install importlib
```

### Install gr-gsm with Docker

```bash
Expand Down
12 changes: 10 additions & 2 deletions scan-and-livemon
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,27 @@ stations and phones in the area as possible, by spreading across as
many operators as possible.
"""

import imp
import importlib.util
import importlib.machinery
from optparse import OptionParser
import subprocess
import sys
import distutils.spawn

def load_source(modname, filename):
loader = importlib.machinery.SourceFileLoader(modname, filename)
spec = importlib.util.spec_from_file_location(modname, filename, loader=loader)
module = importlib.util.module_from_spec(spec)
loader.exec_module(module)
return module

def find_gsm_bases():
grgsm_scanner_path = distutils.spawn.find_executable("grgsm_scanner")
if grgsm_scanner_path is None:
print("Error : Please install gr-gsm")
exit(1)

scanner = imp.load_source('scanner', grgsm_scanner_path)
scanner = load_source('scanner', grgsm_scanner_path)
sys.modules['scanner'] = scanner
(options, args) = scanner.argument_parser().parse_args() #FIXME conflic with argument_parser line 93
list = scanner.do_scan(options.samp_rate, options.band, options.speed,
Expand Down

0 comments on commit e50439a

Please sign in to comment.