Python Forum

Full Version: trouble Navigating aACN[E1.31] Code Base Module
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey Everyone,

I hope this finds y'all well. I'm starting my first project with Python after taking an online venture through Code Academy for a better understanding of Python and learning to code. I have a need to get the sACN[E1.31] protocol from the network port on my machine into another program that I'm using. I've downloaded an sacn module from here: https://pypi.org/project/sacn/#history and have been kind of successful in importing the module into Cinema4D(C4D), but I'm noticing in the console that it's throwing errors for syntax. C4D is running python 2.7, but I don't know what the module was written in as it's probably about 2 years old. I can't see a way to upload screenshots or files here, so I'll try my bes to describe it.

From the source file:
class sACNreceiver:
    def __init__(self, bind_address: str = '0.0.0.0', bind_port: int = 5568):
From the Console Inside C4D:
SyntaxError: invalid syntax
Traceback (most recent call last):
  File "C:\Users\CAVMobile\AppData\Roaming\Maxon\Maxon Cinema 4D R21_64C2B3BD\library\scripts\sacn test.py", line 3, in <module>
    import sacn
  File "C:\Program Files\Maxon Cinema 4D R21\resource\modules\python\libs\python27\sacn\__init__.py", line 1, in <module>
    from sacn.receiver import sACNreceiver, LISTEN_ON_OPTIONS
  File "C:\Program Files\Maxon Cinema 4D R21\resource\modules\python\libs\python27\sacn\receiver.py", line 15
    def __init__(self, bind_address: str = '0.0.0.0', bind_port: int = 5568):
                                   ^
SyntaxError: invalid syntax
Now, I'm not trying to troubleshoot C4D as that's a thread for their forum, but, I'm trying to see why there might be this syntax error being thrown.
This isn't a life or death thing, but it's certainly something that's making me stay up at night hahahaha!

I thank you for your time and hopefully I'll figure out what I'm missing as well!

P.S. Is there a place to post screenshots in this forum?

Cheers!

MattG
Python 2.7 end of life is less than 30 days away.
You should convert to python 3.6 or newer, preferably the latest version (3.8)
Use this version: https://github.com/Hundemeier/sacn
Hey Larz!

Thank you for the response. Right now C4D only supports python 2.7 even after their latest release the past couple months...so yea....that's unfortunate I guess haha! The script you provided is the script I've been trying to use haha, is that written in 3.6? Would that be the reason for the syntax errors?

Cheers!

MattG
The usage that I see is sender = sacn.sACNsender()

where did you get: def __init__(self, bind_address: str = '0.0.0.0', bind_port: int = 5568): ?

Quote:From the source file:
There are many source files, which one (name please)
Crap!

Sorry man, this is from the receiver file. My fault, forgot there's a bunch of scripts in that module. My Bad.

Cheers!

MattG
Hey Y'all,

Figured I'd give an update. Cinema 4D does not support python 3 yet....why...I dunno, but that pretty much answered all the errors I have been getting so....yea. haha! Thankd for your time and I'll keep everyone updated as I know more!

Cheers!

MattG
python 2 end of life is in 25 days: https://pythonclock.org/