remcohaszing / pywakeonlan

A small python module for wake on lan.
https://pywakeonlan.readthedocs.io
MIT License
286 stars 70 forks source link

Python 3 #1

Closed odyslam closed 6 years ago

odyslam commented 8 years ago

I am installing in on my pi and it seems to install only in my library for pyton 2.7, how can i force it to use it in python 3 (unfortunately i have to use python 3)

Thank you

remcohaszing commented 8 years ago

First of all, it's cool to hear people are still using this project. :)

On itself this project should support Python 3. If Python 3 support is the real issue, I think I should be able to solve this.

I'm going to need a bit more detail to answer this though.

  1. What is the operating system? Raspbian (or anything else Debian based)?
  2. How did you try to install this?
odyslam commented 8 years ago

Hey, Thank you for your rapid response! To be honest it’s exactly what i was looking for . I am using it on raspbian (rasp pi 2 ). I installed it by git clone-then setup build, then setup install. It installs only as a python 2.7 library (according to the terminal) and during the installation it doesn’t mention python 3 , something that is proven as python 3 can’t import it. (I hate using python3 but since i am using webiopi i am forces to write my scripts with python3) Thank you for your time :)

On 16 Dec 2015, at 9:54 PM, Remco Haszing notifications@github.com wrote:

First of all, it's cool to hear people are still using this project. :)

On itself this project should support Python 3. If Python 3 support is the real issue, I think I should be able to solve this.

I'm going to need a bit more detail to answer this though.

What is the operating system? Raspbian (or anything else Debian based)? How did you try to install this? — Reply to this email directly or view it on GitHub https://github.com/remcohaszing/pywakeonlan/issues/1#issuecomment-165225361.

remcohaszing commented 8 years ago

You did not mention virtualenv, so I assume you are trying to install this package system-wide as root. I do _not_ recommend this, but it should still work.

I guess this sums up the commands you ran:

$ git clone https://github.com/remcohaszing/pywakeonlan.git
$ cd pywakeonlan
$ ./setup.py build  # This is redundant.
$ ./setup.py install

Note that the shebang in setup.py refers to /usr/bin/env python. If I'm correct this refers to Python 2.7 on your system.

$ /usr/bin/env python --version

This is why it gets installed as a Python 2.7 package.

The closest to your current solution is to explicitly call setup.py with the preferred Python version.

$ python3 setup.py install

However, I recommend installing it using pip

$ pip3 install wakeonlan

I'll make some patches to renew and document the installation process as soon as I have time. ;)

odyslam commented 8 years ago

Hey!, After much search i managed to use my webiopi with python2.7 as i found out that 70% of my modules wouldn’t cooperate with python3 , but really thanks for your swift reply (and thanks to you i found out about pip3 haha)

One last question though, as i am fairly new, what is virtualenv? I haven’t stumbled upon that in any of my projects so i have now idea what you are talking about(although i can imagine). Thank you again for your time :)

On 17 Dec 2015, at 1:02 AM, Remco Haszing notifications@github.com wrote:

You did not mention virtualenv, so I assume you are trying to install this package system-wide as root. I do not recommend this, but it should still work.

I guess this sums up the commands you ran:

$ git clone https://github.com/remcohaszing/pywakeonlan.git $ cd pywakeonlan $ ./setup.py build # This is redundant. $ ./setup.py install Note that the shebang in setup.py refers to /usr/bin/env python. If I'm correct this refers to Python 2.7 on your system.

$ /usr/bin/env python --version This is why it gets installed as a Python 2.7 package.

The closest to your current solution is to explicitly call setup.py with the preferred Python version.

$ python3 setup.py install However, I recommend installing it using pip

$ pip3 install wakeonlan I'll make some patches to renew and document the installation process as soon as I have time. ;)

— Reply to this email directly or view it on GitHub https://github.com/remcohaszing/pywakeonlan/issues/1#issuecomment-165275959.

dpatterson-aio commented 6 years ago

python3 has a fancy bytes.fromhex function, so the packet creation can be something like bytes.fromhex('FF'*6 + mac*16)

remcohaszing commented 6 years ago

This was a question, not an issue. I'm closing this.

@dpatterson-aio that would break Python 2 compatibility.