Error message 'addr' not understood en Supercollider 3.9 - supercollider

I have been using Supercollider 3.8 for a long time and have decided to change the version to 3.9.3,
but it has brought us problems, currently the script.scd returns the following error:
ERROR: Message 'addr' not understood.
RECEIVER:
Instance of Function { (0000022C4663FF48, gc=8C, fmt=00, flg=00, set=02)
instance variables [2]
def : instance of FunctionDef - closed
context : Frame (0000022C45014BD8) of Interpreter:functionCompileContext
}
ARGS:
CALL STACK:
DoesNotUnderstandError:reportError
arg this = <instance of DoesNotUnderstandError>
Nil:handleError
arg this = nil
arg error = <instance of DoesNotUnderstandError>
Thread:handleError
arg this = <instance of Thread>
arg error = <instance of DoesNotUnderstandError>
Object:throw
arg this = <instance of DoesNotUnderstandError>
Object:doesNotUnderstand
arg this = <instance of Function>
arg selector = 'addr'
arg args = [*0]
OSCFuncAddrMessageMatcher:value
arg this = <instance of OSCFuncAddrMessageMatcher>
arg msg = [*33]
arg time = 161.0420767
arg testAddr = <instance of NetAddr>
arg recvPort = 57121
OSCMessageDispatcher:value
arg this = <instance of OSCMessageDispatcher>
arg msg = [*33]
arg time = 161.0420767
arg addr = <instance of NetAddr>
arg recvPort = 57121
Main:recvOSCmessage
arg this = <instance of Main>
arg time = 161.0420767
arg replyAddr = <instance of NetAddr>
arg recvPort = 57121
arg msg = [*33]
^^ The preceding error dump is for ERROR: Message 'addr' not understood.
RECEIVER: a Function

It's impossible to diagnose the problem is without the code that's generating the error.
By way of explanation of the error messsage:
Message 'addr' not understood:
This means the method addr was called on something, e.g. something.addr() that doesn't have a method by that name.
RECEIVER:
Instance of Function:
This means that the "something" is a function.
So, somewhere you might be passing a function as an argument where some other type of object is expected (something that responds to .addr, so probably a NetAddr or Server).

Related

Discord.py | How do I detect if an argument is empty? (with a if statement)

My bot is supposed to send a error message if no arguments are passed.
#bot.command(pass_context = True , aliases=['sl'])
async def slow (ctx, arg):
if arg > '21600':
await ctx.send("You are restricted to ``21600 seconds``")
else:
if arg == None:
await ctx.send(f"Error 00: Please specify slowmode time. e.g: !slow 2")
else:
await ctx.channel.edit(slowmode_delay=arg)
await ctx.send(f"Slowmode set to ``{arg}`` seconds.")
It isn't responding with the error message if no arguments are passed.
2 things; 1, check if the arg is None first. 2, if arg is None, it will show up in the console as an error instead, so make the arg optional
#client.command(pass_context = True , aliases=['sl'])
async def slow (ctx, duration: int=None): #=None makes it optional or you can use Optional[int] and import Optional from typing
if duration == None:
await ctx.send(f"Error 00: Please specify slowmode time. e.g: !slow 2")
if duration > 21600:
await ctx.send("You are restricted to ``21600 seconds``")
else:
await ctx.channel.edit(slowmode_delay=duration)
await ctx.send(f"Slowmode set to ``{duration}`` seconds.")
btw, I changed arg=None to duration: int=None because it's easier to read
You can initialise the argument arg in the function definition, like this:
async def slow(ctx, arg=None):
if arg is None:
await ctx.send("Error! ...")
return
arg = int(arg) # converts arg to an int
# do something...
Also, I don't recommend using string comparisons (such as arg > '21600'). Instead, first convert arg to an int, then compare it with another int object.

Deploy multiple lambda functions through terraform

Trying to deploy multiple lambda functions through terraform but getting error message. i have the lambda code in the s3 bucket. below is my code.
Error: Unbalanced parentheses on main.tf , in resource "aws_lambda_function" "test_lambda": function_name = (for fname in var.lambda_function_names: fname.split(".")[0] if fname == var.lambda_function_names[count.index]) Expected a closing parenthesis to terminate the expression.
variable "lambda_function_names"{
default = [
"test1.py",
"test2.py"
]
}
resource "aws_lambda_function" "test_lambda" {
count = length(var.lambda_function_names) > 0 ? length(var.lambda_function_names) : 0
s3_bucket="test-bucket"
s3_key= "lambda_source_code/${var.lambda_function_names[count.index]}"
function_name = for fname in var.lambda_function_names: fname.split(".")[0] if fname == var.lambda_function_names[count.index])
role = "arn:aws:iam::12344566676:role/lambda-role"
handler = "${var.lambda_function_names[count.index]}.lambda_handler"
runtime = "python3.8"
}

I can ban users if I do -ban [user] [reason], but if I do only -ban [user] it won't ban the user. How can I fix this?

Here's the code
#client.command(pass_context = True)
async def ban(ctx, user: discord.User,*, bugs: str):
if ctx.message.author.server_permissions.administrator or ctx.message.author.id == '562000458181246982':
embed = discord.Embed(title="", description="{} has been banned.".format(user.name), color=0x0072ff)
embed.add_field(name="Reason", value=bugs)
embed.set_author(name="Alpha Moderation", icon_url="https://media.discordapp.net/attachments/562005351353024525/569168417857208320/RealAlpha.png?width=355&height=356")
utc_dt = datetime.now(timezone.utc)
p = utc_dt.strftime(' Time - %H:%M:%S | Date - %d/%m/%Y')
utc = str( p)
txt=str(utc)
embed.set_footer(text=txt)
await client.say(embed=embed)
xd = ctx.message.server.name
embed = discord.Embed(title="", description="You have been banned from: " +xd, color=0x495c66)
embed.add_field(name="Action", value="Ban")
embed.add_field(name="Reason", value=bugs)
embed.set_author(name="Alpha Moderation", icon_url="https://media.discordapp.net/attachments/562005351353024525/569168417857208320/RealAlpha.png?width=355&height=356")
utc_dt = datetime.now(timezone.utc)
p = utc_dt.strftime(' %H:%M:%S • %d/%m/%Y ')
utc = str( p)
a=ctx.message.author
txt= str(a) + " | " + str(utc)
embed.set_footer(text="Banned by: " +txt)
await client.send_message(user, embed=embed)
await client.ban(user)
else:
embed=discord.Embed(title="Permission Denied.", description="<:alphaError:569178991349465088> You don't have permission to use this command.", color=0xEA1025)
await client.say(embed=embed)
https://media.discordapp.net/attachments/562005351353024525/569598677925232651/unknown.png?width=581&height=345
Since Python requires that all arguments be bound to a value, so when you won't pass value to bugs argument, function is missing required argument.
To fix this, you could set default value for bugs argument like this:
#client.command(pass_context=True)
async def ban(ctx, user: discord.User, *, bugs: str = None):
if bugs is None:
# do something when reason is not provided
# e.g. set some default reason value
bugs = "Preemptive ban"
# rest of your code

How do I represent a two-dimensional array in Protocol Buffers?

for example:
[[1,2],[3,4]...]
I just wanted to test if RPC supported a two-dimensional array, But there is something wrong, I am following the official docs.
The server is as follows:
data = [[i, 9] for i in range(128)]
class Greeter(hello_pb2_grpc.GreeterServicer):
def SayHello(self, request, context):
return hello_pb2.HelloReply(results=data)
def serve():
server = grpc.server(futures.ThreadPoolExecutor(max_workers=10), options=[
(cygrpc.ChannelArgKey.max_send_message_length, -1),
(cygrpc.ChannelArgKey.max_receive_message_length, -1)
])
hello_pb2_grpc.add_GreeterServicer_to_server(Greeter(), server)
server.add_insecure_port('[::]:50052')
server.start()
try:
while True:
time.sleep(_ONE_DAY_IN_SECONDS)
except KeyboardInterrupt:
server.stop(0)
if __name__ == '__main__':
serve()
The client is as follows:
def insecure_channel(host, port):
channel = grpc.insecure_channel(
target=host if port is None else '%s:%d' % (host, port),
options=[(cygrpc.ChannelArgKey.max_send_message_length, -1),
(cygrpc.ChannelArgKey.max_receive_message_length, -1)])
return grpc.beta.implementations.Channel(channel)
def run():
channel = grpc.insecure_channel('localhost:50052')
stub = hello_pb2_grpc.GreeterStub(channel)
st = time.time()
response = stub.SayHello(hello_pb2.HelloRequest(name='test'))
et = time.time() - st
print("Greeter client received: {}, {}".format(type(response.results), et))
if __name__ == '__main__':
run()
The protobuf definition is as follows:
syntax = "proto3";
package hello;
service Greeter {
rpc SayHello (HelloRequest) returns (HelloReply) {}
}
message HelloRequest {
string name = 1;
}
message HelloReply {
repeated Result results = 1;
}
message Result {
repeated int32 index = 1;
repeated int32 count = 2;
}
But I get the error like this:
File "greeter_server.py", line 19, in SayHello
return hello_pb2.HelloReply(results=data)
TypeError: Parameter to MergeFrom() must be instance of same class: expected hello.Result got list.
I am using python3.
Thanks in advance.
As per your question, [[1,2],[3,4]...] is an array of arrays.
Something like this should solve your problem:
message InternalArray {
repeated int internal_array = 1;
}
repeated InternalArray array = 1;
Problem is a list you are passing where hello.Result is expected.
Use:
import hello_pb2
to_return = hello_pb2.Result()
to_return.index = 111
to_return.count = 222
now return `to_return` from rpc call.

Trouble installing Dirt-Samples quark in SuperCollider for Tidal

I am trying to install Tidal, and I am running in to trouble installing the Dirt-Samples quark in SuperCollider 3.6.6. I followed the directions in the SuperDirt repository and put the SuperDirt, Dirt-Samples, and Vowel quarks in ~/.local/share/SuperCollidor/Extensions/quarks/. I am running Ubuntu 14.04 on a Dell Inspiron 3521.
In SuperCollider I am running Quarks.gui. In the list of quarks, Vowel appears to be installed, with a + next to it, but Dirt-Samples and SuperDirt have a - next to them. When I select Dirt-Samples so there is a * next to it and click Apply, I get this error in the SuperCollidor IDE:
ARGS:
Character 47 '/'
PROTECTED CALL STACK:
Meta_MethodError:new 0x3c794c0
arg this = DoesNotUnderstandError
arg what = nil
arg receiver = nil
Meta_DoesNotUnderstandError:new 0x3c7b480
arg this = DoesNotUnderstandError
arg receiver = nil
arg selector = split
arg args = [ / ]
Object:doesNotUnderstand 0x2adebc0
arg this = nil
arg selector = split
arg args = nil
a FunctionDef 0x2fa4900
sourceCode = "<an open Function>"
arg oneq = Quark: Dirt-Samples
ArrayedCollection:do 0x3b8fe80
arg this = [ Quark: Dirt-Samples ]
arg function = a Function
var i = 0
QuarkSVNRepository:checkout 0x2fa43c0
arg this = a QuarkSVNRepository
arg q = Quark: Dirt-Samples
arg localRoot = /home/nathan/.local/share/SuperCollider/quarks
arg sync = true
var subfolders = nil
var fullCheckout = [ ]
var pathSoFar = nil
var skeletonCheckout = [ ]
var args = nil
Quarks:checkout 0x3907d00
arg this = a Quarks
arg name = Dirt-Samples
arg version = nil
arg sync = true
var q = Quark: Dirt-Samples
Quarks:install 0x3909ac0
arg this = a Quarks
arg name = Dirt-Samples
arg includeDependencies = true
arg checkoutIfNeeded = true
var q = nil
var deps = nil
var installed = nil
var dirname = nil
var quarksForDep = nil
a FunctionDef 0x39da400
sourceCode = "<an open Function>"
arg qView = a QuarkViewQt
ArrayedCollection:do 0x3b8fe80
arg this = [ a QuarkViewQt, a QuarkViewQt, a QuarkViewQt, a QuarkViewQt, a QuarkViewQt, a QuarkViewQt, a QuarkViewQt, a QuarkViewQt, a QuarkViewQt, a QuarkViewQt, a QuarkViewQt, a QuarkViewQt, a QuarkViewQt, a QuarkViewQt, a QuarkViewQt, a QuarkViewQt, a QuarkViewQt, a QuarkViewQt, a QuarkViewQt, a QuarkViewQt, a QuarkViewQt, a QuarkViewQt, a QuarkViewQt, a QuarkViewQt, a QuarkViewQt, a QuarkViewQt, a QuarkViewQt, a QuarkViewQt, a QuarkViewQt, a QuarkViewQt, a QuarkViewQt, a QuarkViewQt, a QuarkViewQt, a QuarkViewQt, ...etc...
arg function = a Function
var i = 92
Function:prTry 0x2dc7300
arg this = a Function
var result = nil
var thread = a Thread
var next = a Function
var wasInProtectedFunc = true
Function:protect 0x2dc6880
arg this = a Function
arg handler = a Function
var result = nil
a FunctionDef 0x2d870c0
sourceCode = "<an open Function>"
Function:prTry 0x2dc7300
arg this = a Function
var result = nil
var thread = a Thread
var next = nil
var wasInProtectedFunc = false
CALL STACK:
DoesNotUnderstandError:reportError 0x4d51268
arg this = <instance of DoesNotUnderstandError>
< closed FunctionDef > 0x4d48418
arg error = <instance of DoesNotUnderstandError>
Integer:forBy 0x468a6d8
arg this = 0
arg endval = 0
arg stepval = 2
arg function = <instance of Function>
var i = 0
var j = 0
SequenceableCollection:pairsDo 0x49be958
arg this = [*2]
arg function = <instance of Function>
Scheduler:seconds_ 0x2a7cbd8
arg this = <instance of Scheduler>
arg newSeconds = 1470285930.1456
Meta_AppClock:tick 0x3ec45a8
arg this = <instance of Meta_AppClock>
var saveClock = <instance of Meta_SystemClock>
Process:tick 0x465a508
arg this = <instance of Main>
^^ The preceding error dump is for ERROR: Message 'split' not understood.
RECEIVER: nil
I don't know what is causing this 'split' error. Any help getting from here to being able to run SuperDirt.start in SuperCollider would be greatly appreciated. Thanks!
These quarks (SuperDirt, Dirt-Samples, Vocal) all appear to install correctly in SuperCollider v3.7+. There were major fixes and improvements to Quarks between 3.6.x and 3.7, so this will probably be solved by upgrading.
If you're dependent on 3.6.x specifically, you can probably proceed in using Tidal. Placing the files in the quarks folder as you described is ALL that's required to install them (the Quarks GUI does exactly and only this) - there's nothing additional done by the Quarks gui / Quarks.install(). A simple recompile / restart should pick up the quarks and everything should work fine.
https://supercollider.github.io/download

Resources