javl / InstaxBLE

MIT License
54 stars 6 forks source link

AttributeError: module 'socket' has no attribute 'AF_BLUETOOTH' #3

Closed caichunjian520 closed 1 year ago

caichunjian520 commented 1 year ago

When I run python3 InstaxBLE.py, it shows error AttributeError: module 'socket' has no attribute 'AF_BLUETOOTH'

I have run these step by step git clone https://github.com/javl/InstaxBLE.git cd InstaxBle python3 -m venv venv source venv/bin/activate pip install -r requirements.txt python3 InstaxBLE.py

javl commented 1 year ago

Ah, turns out those sockets dont work on Windows. I'll see if there is an alternative.

caichunjian520 commented 1 year ago

I use macbook, MacOS Monterey

javl commented 1 year ago

I think the socket should work on Mac, but I'll try and change the code to use a different method. I'll post here if/when that works.

javl commented 1 year ago

Hey @caichunjian520 Could you give the branch called gatt a try? I removed the need for sockets, I think this should work. Every now and then I do get some error (like le-connection-abort-by-local) but just restart the code to try again.

caichunjian520 commented 1 year ago

@javl Thanks, I will try it tomorrow.

caichunjian520 commented 1 year ago

@javl I just tried with gatt branch,it works. Looking for instax printer... INSTAX-10458647(IOS) Printing is disabled

I know if I want to print photo,I should change the code to instax = InstaxBle(enablePrinting=True) But there are 2/10 Film Sheets left for me to play with other features.

javl commented 1 year ago

Without actual printing you still don't know if it works, but at least the socket problem has been fixed ;)

javl commented 1 year ago

Reopening as I think the actual printing using gatt doesn't work yet. I'll use this issue to track the progress.

zoz06 commented 1 year ago

Hi and thanks for your work. I'm having too the same bug with Macos BigSur and the main branch. Just a question: what should I type to get the gatt (or the new test gatt?) branch: I typed but I don't find any difference with the gatt. Sorry I'm a noob in this domain. git clone https://github.com/javl/InstaxBLE.git cd InstaxBle python3 -m venv venv source venv/bin/activate pip install -r requirements.txt python3 InstaxBLE.py

javl commented 1 year ago

@zoz06 you should be able to type git checkout gatt to switch to the other branch. Not sure how well it works at the moment, I've been moving some things around and need to improve it.

I should try it on an old MacBook I should have somewhere to make sure it works.

javl commented 1 year ago

@caichunjian520 If you're still interested: I've updated all the code (on the main branch) and it now works on MacOS as well! Just tested on a Macbook Air using macOS Monterey.