Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #82212
| Path | csiph.com!usenet.pasdenom.info!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!news.glorb.com!news.astraweb.com!border5.newsrouter.astraweb.com!not-for-mail |
|---|---|
| From | sohcahtoa82@gmail.com.remove-cdt-this |
| To | hugocoolens |
| Subject | Re: [newbie] how to make program suggest to install missing modules |
| Message-ID | <54866F2E.1750.complang@piz.noip.com> (permalink) |
| X-Comment-To | hugocoolens |
| Newsgroups | comp.lang.python |
| In-Reply-To | <54866F2E.1746.complang@piz.noip.com> |
| References | <54866F2E.1746.complang@piz.noip.com> |
| X-FTN-AREA | COMP.LANG.PYTHON |
| X-FTN-PID | SoupGate-Win32 v1.05 |
| X-FTN-MSGID | <0757295c-1dac-40e8-9ebb-2128a7d41e38@googlegroups.com> 01b6edeb |
| X-FTN-REPLY | <a2994123-205b-4417-ba21-6903dbfb4f4a@googlegroups.com> 83c168e9 |
| Content-Type | text/plain; charset=IBM437 |
| Content-Transfer-Encoding | 8bit |
| X-Gateway | piz.noip.com [Synchronet 3.15b-Win32 NewsLink 1.92] |
| X-Server | piz.noip.me |
| Date | 9 Dec 2014 11:32:00 -0500 |
| Lines | 34 |
| Organization | Unlimited download news at news.astraweb.com |
| NNTP-Posting-Host | 2266ad8f.news.astraweb.com |
| X-Trace | DXC=LP`[=a9Aa>U;0`5D\QI41SL?0kYOcDh@ZRScV177L_PQZh[e@ZS;QSSl23]GVn`ZmVMHo6fPSBkU[04hIVDTD?[[7g\XjYcGehYfPiGS6_2a\] |
| Xref | csiph.com comp.lang.python:82212 |
Show key headers only | View raw
To: hugocoolens
On Monday, December 8, 2014 9:44:50 AM UTC-8, hugocoolens wrote:
> I'd like to add the following to a python-program:
>
> when a module (take rtlsdr as an example) is not installed on the system I'd
like to ask the program something like:
>
> module rtlsdr is missing, shall I install it? y or n
> if n -->sorry but then I can't run this program and quit program
> if y -->execute this command:
> os.system(sudo pip install pyrtlsdr)
>
> continue program
>
> can anyone here show me how to perform this properly?
>
> thanks in advance
> hugo
Hint:
try:
import someModule
except ImportError:
print "Module is missing"
# handle it!
Just make sure to attempt to import it again after making the call to pip to
install it.
--- SoupGate-Win32 v1.05
* Origin: <SpaceSST.BBS.Fidonet<>NNTP.gateway.@.piz.noip.me> (1:249/999)
--- Synchronet 3.15b-Win32 NewsLink 1.92
SpaceSST BBS Usenet <> Fidonet Gateway
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
[newbie] how to make program suggest to install missing modules "hugocoolens" <hugocoolens@1:249/999.remove-cdt-this> - 2014-12-09 11:32 -0500 Re: [newbie] how to make program suggest to install missing modules sohcahtoa82@gmail.com.remove-cdt-this - 2014-12-09 11:32 -0500
csiph-web