awkman / pywifi

A cross-platform module for manipulating WiFi devices.
MIT License
453 stars 154 forks source link

Import error when using example (python 3.3.0 - win 10) #10

Closed die-gans closed 5 years ago

die-gans commented 8 years ago

Occurs when trying to import native_wifi from wifiutils. This is done by using the example provided.

Traceback (most recent call last):
  File "C:/Users/goose/PycharmProjects/wifiSwap/main.py", line 1, in <module>
    import pywifi
  File "C:\Python33\lib\site-packages\pywifi\__init__.py", line 3, in <module>
    from .pywifi import *
  File "C:\Python33\lib\site-packages\pywifi\pywifi.py", line 5, in <module>
    from .iface import Interface
  File "C:\Python33\lib\site-packages\pywifi\iface.py", line 7, in <module>
    from .win import wifiutils
  File "C:\Python33\lib\site-packages\pywifi\win\wifiutils.py", line 6, in <module>
    from . import native_wifi as wifiapi
ImportError: cannot import name native_wifi

Not sure if there is an issue with the package or my current setup (using latest version of pycharm). Doesn't seem to have a circular import.

awkman commented 8 years ago

Now pywifi moves to v1.0.0, please try it.

die-gans commented 8 years ago

breaks at wifiutils:

Traceback (most recent call last):
  File "C:/Users/goose/PycharmProjects/wifiSwap/main.py", line 1, in <module>
    import pywifi
  File "C:\Python33\lib\site-packages\pywifi\__init__.py", line 14, in <module>
    from .wifi import PyWiFi
  File "C:\Python33\lib\site-packages\pywifi\wifi.py", line 15, in <module>
    from .iface import Interface
  File "C:\Python33\lib\site-packages\pywifi\iface.py", line 11, in <module>
    from .win import wifiutil
ImportError: cannot import name wifiutil

Just to confirm, is this an issue with the package?

awkman commented 8 years ago

I tested under 3.5.2 env and it work fine. But testing under python3.3.5 env. I found the it failed: `Python 3.3.5 (v3.3.5:62cf4e77f785, Mar 9 2014, 10:35:05) [MSC v.1600 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information.

import pywifi Traceback (most recent call last): File "", line 1, in File "C:\Python33\lib\site-packages\pywifiinit.py", line 14, in from .wifi import PyWiFi File "C:\Python33\lib\site-packages\pywifi\wifi.py", line 15, in from .iface import Interface File "C:\Python33\lib\site-packages\pywifi\iface.py", line 11, in from .win import wifiutil File "C:\Python33\lib\site-packages\pywifi\win\wifiutil.py", line 10, in from enum import Enum ImportError: No module named 'enum'

Maybe you can try it under python3.4+

wgaylord commented 8 years ago

Maybe install enum? (It is in pypi)

die-gans commented 8 years ago

I'll try this later on today, Might be a good idea to show the interpreter requirement in the readme.

awkman commented 8 years ago

Yes, you are right. I found the 'from enum import Enum' can be removed because now pywifi doesn't need it anymore. After that, pywif can work properly in py3.3 env. I will update both of the readme and code recently.

awkman commented 8 years ago

@thepizzagui After changing the test env to py3.3.0, I saw the same issue as you reported. It seems there are some changes between 3.3.0 and 3.3.5. I think this issue will not be fixed recently because I want to replace the d-bus communication between pywifi and wpa_supplicant with sockets.

die-gans commented 8 years ago

Upgrading seems to do the trick, looks like we'll never know!

edgedroper commented 6 years ago

import pywifi error! my python env is 3.6.3

import pywifi Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python3.6/site-packages/pywifi/init.py", line 15, in from .wifi import PyWiFi File "/usr/local/lib/python3.6/site-packages/pywifi/wifi.py", line 15, in from .iface import Interface File "/usr/local/lib/python3.6/site-packages/pywifi/iface.py", line 15, in raise NotImplementedError NotImplementedError

this version don't support pywifi?

wgaylord commented 6 years ago

What operating system?

Going to assume Mac? As its not linux or windows based off the import.

edgedroper commented 6 years ago

mac OS 10.13.1

wgaylord commented 6 years ago

If you look at the readme you will see that Mac is not currently supported.

On Dec 5, 2017, at 8:46 AM, edgedroper notifications@github.com wrote:

mac OS 10.13.1

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

edgedroper commented 6 years ago

OK,Thank you wgaylord , i will use it at linux!

wgaylord commented 6 years ago

Your welcome

On Dec 5, 2017, at 8:55 AM, edgedroper notifications@github.com wrote:

OK,Thank you wgaylord , i will use it at linux!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.