Python Forum
AttributeError: attribute 'port' of 'liblo._ServerBase' objects is not writable
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
AttributeError: attribute 'port' of 'liblo._ServerBase' objects is not writable
#1
i ve muse headband and arduino.I want to take datas from muse and give them to arduino for some calculations.

#define libs
from liblo import *
import sys
import time
import serial
import math

#define arduino serial way
ser = serial.Serial('/dev/ttyACM0')

#class
class MuseServer(ServerThread):

#listen for messages on port 5000
def __init__(self):
ServerThread.__init__(self, port=5000)
self.port=5000
self.alpha = 0.0

# take datas from device
@make_method('/muse/acc', 'fff')
def acc_callback(self, path, args):
acc_x, acc_y, acc_z = args
print "%s %f %f %f" % (path, acc_x, acc_y, acc_z)

#connect to device
try:
server = MuseServer()
except ServerError, err:
print str(err)
sys.exit()

server.start()

if __name__ == "__main__":
while 1:
time.sleep(1)
When i run on terminal i see "AttributeError: attribute 'port' of 'liblo._ServerBase' objects is not writable" Error.

I use Python 2.7
Reply
#2
repost your code with proper indentation and in code tags. see BBcode help for more info
Reply
#3
i ve muse headband and arduino.I want to take datas from muse and give them to arduino for some calculations.
#define libs
from liblo import *
import sys
import time
import serial
import math

#define arduino serial way
ser = serial.Serial('/dev/ttyACM0')

#class
class MuseServer(ServerThread):

#listen for messages on port 5000
def __init__(self):
ServerThread.__init__(self, port=5000)
self.port=5000
self.alpha = 0.0

# take datas from device
@make_method('/muse/acc', 'fff')
def acc_callback(self, path, args):
acc_x, acc_y, acc_z = args
print "%s %f %f %f" % (path, acc_x, acc_y, acc_z)

#connect to device
try:
server = MuseServer()
except ServerError, err:
print str(err)
sys.exit()

server.start()

if __name__ == "__main__":
while 1:
time.sleep(1)
When i run on terminal i see :
Error:
AttributeError: attribute 'port' of 'liblo._ServerBase' objects is not writable" Error.
I use Python 2.7

First of all i want to state my apologies.I am new to Python and Forum.
I frequently violate forum rules.I ll be more careful after that.
Is there an easy way to fix this indentation?
What kind of Python editor should i use?
Or what is suggestions?
Thanks.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Passing writable arguments to functions. Assembler 11 960 Jan-15-2024, 11:32 PM
Last Post: sgrey
  getpass.getpass() results in AttributeError: module 'os' has no attribute 'O_NOCTTY' EarthAndMoon 4 783 Oct-03-2023, 02:00 PM
Last Post: deanhystad
  AttributeError: '_tkinter.tkapp' object has no attribute 'username' Konstantin23 4 1,724 Aug-04-2023, 12:41 PM
Last Post: Konstantin23
  Parallel processing - AttributeError: Can't get attribute 'sktimekmeans' Mohana1983 1 762 Jun-22-2023, 02:33 AM
Last Post: woooee
  Python: AttributeError: 'PageObject' object has no attribute 'extract_images' Melcu54 2 3,912 Jun-18-2023, 07:47 PM
Last Post: Melcu54
  cx_oracle Error - AttributeError: 'function' object has no attribute 'cursor' birajdarmm 1 2,375 Apr-15-2023, 05:17 PM
Last Post: deanhystad
  Pandas AttributeError: 'DataFrame' object has no attribute 'concat' Sameer33 5 5,655 Feb-17-2023, 06:01 PM
Last Post: Sameer33
  AttributeError: 'numpy.ndarray' object has no attribute 'load' hobbyist 8 7,134 Jul-06-2022, 10:55 AM
Last Post: deanhystad
  AttributeError: 'numpy.int32' object has no attribute 'split' rf_kartal 6 4,413 Jun-24-2022, 08:37 AM
Last Post: Anushka00
  AttributeError: 'list' object has no attribute 'upper' Anldra12 4 4,895 Apr-27-2022, 09:27 AM
Last Post: Anldra12

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020