Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WindowsParser support for _default_interface #25

Open
PaluMacil opened this issue May 3, 2018 · 5 comments
Open

WindowsParser support for _default_interface #25

PaluMacil opened this issue May 3, 2018 · 5 comments

Comments

@PaluMacil
Copy link

_default_interface throws an attribute exception on Windows. I'm only a hobbyist in Python (work is C#) so I could be missing something, but it looks like this is only implemented for Unix. It also looks fairly easy to add. If I'm not misunderstanding anything, I'd like to make a pull request. I'm using your library for observing Raspberry Pis I'll register to my home network, but I figure I might as well use Windows to test so that I can make the library better for cross-compat cases.

@benjaoming
Copy link
Collaborator

There are challenges on Windows indeed! Your input is most welcome!

@PaluMacil
Copy link
Author

If you know things that are missing in Windows and make an issue (or issues) listing them with help wanted tags, I'm sure people would start picking them up. For the usefulness of this library, it doesn't seem that complicated to develop new features.

@PaluMacil
Copy link
Author

To clarify my plans, I am using more Python now (primary language at work), but I have not had any need for this feature on Windows yet since I've been even more rarely on Windows machines. However! It looks like @dogwynn made a PR that resolves this request for Windows. I can certainly close this if there is nothing else needed here.

@benjaoming
Copy link
Collaborator

@PaluMacil all contributions are welcome! I don't run Windows so I have no idea what specific issues can be. But I would say that localization of the ipconfig command seems to be the major issue, and then probably some flags from ifconfig aren't fully implemented.

I've just release #56 in 0.22

@mdogancay
Copy link

i got error on python 3.11 in windows 10:

$ ipython
P:\p\python\AIEngine\Python311\Lib\site-packages\IPython\core\interactiveshell.py:937: UserWarning: Attempting to work in a virtualenv. If you encounter problems, please install IPython inside the virtualenv.
  warn(
Python 3.11.9 (tags/v3.11.9:de54cf5, Apr  2 2024, 10:12:12) [MSC v.1938 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.29.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import ifcfg

In [2]: print(ifcfg.default_interface())
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[2], line 1
----> 1 print(ifcfg.default_interface())

File P:\p\python\AIEngine\Python311\Lib\site-packages\ifcfg\__init__.py:81, in default_interface(ifconfig, route_output)
     74 """
     75 Return just the default interface device dictionary.
     76
     77 :param ifconfig: For mocking actual command output
     78 :param route_output: For mocking actual command output
     79 """
     80 global Parser
---> 81 return Parser(ifconfig=ifconfig)._default_interface(route_output=route_output)

AttributeError: 'WindowsParser' object has no attribute '_default_interface'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants