You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
net.py is my sample application to set the ip address of my eth0 interface. I get the following error while running the application.
Traceback (most recent call last):
File "net.py", line 119, in
inf.set_ip("192.168.7.59");
File "/usr/lib/python3.5/site-packages/pynetlinux/ifconfig.py", line 210, in set_ip
ifreq = struct.pack('16sH2s4s8s', self.name, AF_INET, '\x00'*2, ipbytes, '\x00'*8)
struct.error: argument for 's' must be a bytes object
Please help me with the error.
The text was updated successfully, but these errors were encountered:
Hello, there @VijayalakshmiSundaravaradhan , I know this an old thread but since the package developer is not responding for a while , Just want to point this for reference for anyone who faces the same problem in the future .
I have been trying to build a simple GUI tool for managing network interfaces and came across this same error you mentioned.. after a little research I found it's because of the struct format that is passed to the function struct.pack('16sH2s4s8s' ...), you can find how this format works in details here . This module performs conversions between Python values and C structs represented as Python bytes objects.
these are the most used in the project
s -----> char[] | bytes char array in C is string for python so make sure the self.name is in byte
H ----> unsigned short | integer
so whenever you get this error go to the ifconfig.py and edit the line in the error
net.py is my sample application to set the ip address of my eth0 interface. I get the following error while running the application.
Traceback (most recent call last):
File "net.py", line 119, in
inf.set_ip("192.168.7.59");
File "/usr/lib/python3.5/site-packages/pynetlinux/ifconfig.py", line 210, in set_ip
ifreq = struct.pack('16sH2s4s8s', self.name, AF_INET, '\x00'*2, ipbytes, '\x00'*8)
struct.error: argument for 's' must be a bytes object
Please help me with the error.
The text was updated successfully, but these errors were encountered: