Python Forum
Help to activate the "USB Modem" with Python
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help to activate the "USB Modem" with Python
#1
Hi everyone,

I am trying to activate and deactivate the "usb modem" by Python code, but it does not work, do you know any way to do it?

USB Modem:

[Image: vodafonethestickusb.jpg]

I tried with "cmd" command line but it did not work Cry :
import os
cmd = 'ifconfig wlan0 down'
os.system(cmd)

I appreciate very your comments

Regards
Karlo
Reply
#2
I don't see where this is related to python.
Reply
#3
Quote:I tried with "cmd" command line but it did not work
show complete script,
how you ran it from cmd line and
full verbatim traceback
Reply
#4
Hi,

I do it for wifi and it works, but it does not work for the usb modem:

-------------------------------
import os, sys
import time

os.system("Ipconfig /release")

time.sleep(3)

os.system("Ipconfig /renew")

------------------------------
Do you know any other way?

Thanks for the feedback
Reply
#5
I presume you are using Windows and that the device is configured correctly and works without Python.

The commands are ipconfig /renew <Adapter> and ipconfig /release <Adapter> .

The Adapter option is only available for a device using DHCP. For devices using a static ip address you need to specify the adapter name, which can be found using ipconfig /all . Refer to MS Technet ipconfig.
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Can Not Activate Environment hammer 6 7,281 Mar-05-2022, 10:26 AM
Last Post: snippsat
Question SMS sending using USRobotics modem Jacobus 2 2,465 Mar-11-2021, 09:59 PM
Last Post: nilamo
  Python win32com.client: What are the syntax to open exe file & activate its window? JaneTan 0 4,191 Oct-14-2020, 09:09 AM
Last Post: JaneTan
  Activate Winodw/ Set focus biprabu 0 1,659 Sep-07-2020, 04:05 AM
Last Post: biprabu
  Send SMS with gsm modem mariolopes 3 4,818 Oct-15-2019, 08:22 PM
Last Post: micseydel
  get and reuse the token value with huawei modem Reims 1 4,572 Oct-02-2019, 04:29 AM
Last Post: Reims
  Dialup Modem using pyserial - Need it to show response from the other end. Rython 1 3,533 Jun-20-2019, 10:09 PM
Last Post: roy
  Auto activate conda env in Pycharm terminal ntuttle 0 4,770 Mar-08-2019, 03:56 PM
Last Post: ntuttle
  Read data of Wireless Modem in Byte Format barry76 2 2,636 Jan-31-2019, 11:26 AM
Last Post: barry76
  How to detect wireless modem connected serially to my laptop in python barry76 3 3,546 Jan-08-2019, 06:18 AM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020