Traceback (most recent call last):
File "C:\Users\Evan\Desktop\Gamble\main.py", line 159, in <module>
main()
File "C:\Users\Evan\Desktop\Gamble\main.py", line 128, in main
link = create_clip(count, "WITHDRAW", root)
File "C:\Users\Evan\Desktop\Gamble\main.py", line 53, in create_clip
new = video.subclip(int(frame / 60 - 5), int(frame / 60 + 5))
File "C:\Users\Evan\anaconda3\envs\F\lib\site-packages\decorator.py", line 232, in fun
return caller(func, *(extras + args), **kw)
File "C:\Users\Evan\anaconda3\envs\F\lib\site-packages\moviepy\decorators.py", line 79, in wrapper
names = inspect.getfullargspec(func).args
NameError: name 'func' is not defined
I haven't altered anything in the package nor could I find anything online about this the code causing this error in question is
with VideoFileClip(root) as video:
new = video.subclip(int(frame / 60 - 5), int(frame / 60 + 5))
new.write_videofile(f'{root.split(".")[0]}/{claim}{str(datetime.timedelta(seconds=int(frame / 60)))}', audio_codec='aac')
It looks like they accepted a PR that broke the code. I managed to fix it by going into decorators.py and changing any instance of "func" to "f"
Related
I am trying to do a cdk deployment, where I am just copying the example from the documentation. See example below (https://docs.aws.amazon.com/cdk/api/v2/python/aws_cdk.aws_stepfunctions/StateMachineFragment.html#aws_cdk.aws_stepfunctions.StateMachineFragment)
from aws_cdk import (
# Duration,
Stack,
aws_stepfunctions as sfn,
aws_stepfunctions_tasks as tasks,
)
from constructs import Construct
class MyJob(sfn.StateMachineFragment):
def __init__(self, parent, id, *, job_flavor):
super().__init__(parent, id)
choice = sfn.Choice(self, "Choice").when(sfn.Condition.string_equals("$.branch", "left"), sfn.Pass(self, "Left Branch")).when(sfn.Condition.string_equals("$.branch", "right"), sfn.Pass(self, "Right Branch"))
# ...
self.start_state = choice
self.end_states = choice.afterwards().end_states
def start_state(self):
return self._start_state
def end_states(self):
return self._end_states
class CdkStateMachineFragmentStack(Stack):
def __init__(self, scope, id):
super().__init__(scope, id)
# Do 3 different variants of MyJob in parallel
parallel = sfn.Parallel(self, "All jobs").branch(MyJob(self, "Quick", job_flavor="quick").prefix_states()).branch(MyJob(self, "Medium", job_flavor="medium").prefix_states()).branch(MyJob(self, "Slow", job_flavor="slow").prefix_states())
sfn.StateMachine(self, "MyStateMachineFragmentTest",
definition=parallel
)
When deploying, I get the following error:
Traceback (most recent call last):
File "app.py", line 10, in
CdkStateMachineFragmentStack(app, "CdkStateMachineFragmentStack",
File "/home/workspace/development/cdk/cdk_test/cdk_state_machine_fragment/.venv/lib/python3.8/site-packages/jsii/_runtime.py", line 111, in call
inst = super().call(*args, **kwargs)
File "/home/workspace/development/cdk/cdk_test/cdk_state_machine_fragment/cdk_state_machine_fragment/cdk_state_machine_fragment_stack.py", line 34, in init
sfn.StateMachine(self, "MyStateMachineFragmentTest",
File "/home/workspace/development/cdk/cdk_test/cdk_state_machine_fragment/.venv/lib/python3.8/site-packages/jsii/_runtime.py", line 111, in call
inst = super().call(*args, **kwargs)
File "/home/workspace/development/cdk/cdk_test/cdk_state_machine_fragment/.venv/lib/python3.8/site-packages/aws_cdk/aws_stepfunctions/init.py", line 6871, in init
jsii.create(self.class, self, [scope, id, props])
File "/home/workspace/development/cdk/cdk_test/cdk_state_machine_fragment/.venv/lib/python3.8/site-packages/jsii/_kernel/init.py", line 336, in create
response = self.provider.create(
File "/home/workspace/development/cdk/cdk_test/cdk_state_machine_fragment/.venv/lib/python3.8/site-packages/jsii/_kernel/providers/process.py", line 363, in create
return self._process.send(request, CreateResponse)
File "/home/workspace/development/cdk/cdk_test/cdk_state_machine_fragment/.venv/lib/python3.8/site-packages/jsii/_kernel/providers/process.py", line 340, in send
raise RuntimeError(resp.error) from JavaScriptError(resp.stack)
RuntimeError: Cannot read properties of undefined (reading 'bindToGraph')
I tried already what is suggested in the following stack overflow post [https://stackoverflow.com/questions/70553737/cannot-read-properties-of-undefined-reading-bindtograph] getting a different error:
Traceback (most recent call last):
File "app.py", line 10, in
CdkStateMachineFragmentStack(app, "CdkStateMachineFragmentStack",
File "/home/workspace/development/cdk/cdk_test/cdk_state_machine_fragment/.venv/lib/python3.8/site-packages/jsii/_runtime.py", line 111, in call
inst = super().call(*args, **kwargs)
File "/home/workspace/development/cdk/cdk_test/cdk_state_machine_fragment/cdk_state_machine_fragment/cdk_state_machine_fragment_stack.py", line 34, in init
parallel = sfn.Parallel(self, "All jobs").branch(MyJob(self, "Quick", job_flavor="quick").prefix_states()).branch(MyJob(self, "Medium", job_flavor="medium").prefix_states()).branch(MyJob(self, "Slow", job_flavor="slow").prefix_states())
File "/home/workspace/development/cdk/cdk_test/cdk_state_machine_fragment/.venv/lib/python3.8/site-packages/jsii/_runtime.py", line 111, in call
inst = super().call(*args, **kwargs)
File "/home/workspace/development/cdk/cdk_test/cdk_state_machine_fragment/cdk_state_machine_fragment/cdk_state_machine_fragment_stack.py", line 18, in init
self.start_state = choice
AttributeError: can't set attribute
Could you support me?
Thanks,
Pablo
While running the AutoEncoder model in PyTorch, I found a strange error.
My code:
model = AutoEncoder(num_items, args.inner_layers, num_items, da=args.num_attention, dropout_rate=args.dropout_rate)
item_vector = self.linear1.weight[:, T.LongTensor(batch_item_index[0].astype(np.int32))]
inner_product = item_vector.t().mm(self.linear4.weight.t())
I tried to make the index start from 0 after seeing the explanation that the cause of the batch index was -1 among little similar problems(https://github.com/jwyang/faster-rcnn.pytorch/issues/311), but it did not work.
This is the first time I haven't had a similar question on Stack Overflow, what am I doing wrong?
Traceback (most recent call last):
File "run.py", line 155, in <module>
main()
File "run.py", line 151, in main
train_autoencoder(train_matrix, test_set)
File "run.py", line 86, in train_autoencoder
y_pred = model(batch_item_index, place_correlation)
File "C:\Users\user\anaconda3\envs\saenad\lib\site-packages\torch\nn\modules\module.py", line 491, in __call__
result = self.forward(*input, **kwargs)
File "C:\Users\user\saenad\model.py", line 58, in forward
inner_product = item_vector.t().mm(self.linear4.weight.t())
RuntimeError: invalid argument 1: out of range at c:\programdata\miniconda3\conda-bld\pytorch_1524543037166\work\aten\src\th\generic/THTensor.cpp:454**
I found the item_vector is empty tensor([[]])!
So I added the code to handle an exception if item_vector.Size is 0 with below code.
if item_vector.shape == torch.Size([0]):
continue
<-- it works.
Hope this helps someone with the same error.:)
I am reading a set of coordinates from a file to produce a shape in the Python Turtle. After reading reading in the coordinates, I have written a for loop that goes through the list of coords and draws them. However, upon running with a correct file name, I get this error:
Traceback (most recent call last):
File "C:\Users\06113\Desktop\My Stuff\Python Saves\Vec Draw\Vec Draw.py", line 55, in <module>
t.goto(cs)
File "C:\Users\06113\AppData\Local\Programs\Python\Python38-32\lib\turtle.py", line 1774, in goto
self._goto(Vec2D(*x))
File "C:\Users\06113\AppData\Local\Programs\Python\Python38-32\lib\turtle.py", line 3195, in _goto
self._update() #count=True)
File "C:\Users\06113\AppData\Local\Programs\Python\Python38-32\lib\turtle.py", line 2660, in _update
self._update_data()
File "C:\Users\06113\AppData\Local\Programs\Python\Python38-32\lib\turtle.py", line 2650, in _update_data
self.screen._drawline(self.currentLineItem, self.currentLine,
File "C:\Users\06113\AppData\Local\Programs\Python\Python38-32\lib\turtle.py", line 543, in _drawline
cl.append(x * self.xscale)
TypeError: can't multiply sequence by non-int of type 'float'
Is there any way at all that I could fix this in MY file? I would rather not go into the turtle module where I could easily mess something up.
The code for this section in my file is:
t = turtle.Turtle(visible=False)
t.speed(0)
for i in range(0, len(coord_list), 2):
if i == 0 and i+1 == 1:
fcs = (coord_list[i], coord_list[i+1])
t.pu()
t.goto(fcs)
t.pd()
pass
else:
cs = (coord_list[i], coord_list[i+1])
t.goto(cs)
cs = None
pass
pass
t.goto(fcs)
print("Vector image drawn.")
I have setup a function that iterates over combinations of chars to form strings.
It is recursive to itself, the recursive call looks like that:
testG(charNum - 1, arr2)
But when i call the entire function, I get this error:
>>> testSpeedGPU()
Traceback (most recent call last):
File "<pyshell#9>", line 1, in <module>
testSpeedGPU()
File "F:\Script Projects#\HASHFinder.py", line 90, in testSpeedGPU
testG(4, [''])
File "D:\Python\lib\site-packages\numba\cuda\dispatcher.py", line 40, in __call__
return self.compiled(*args, **kws)
File "D:\Python\lib\site-packages\numba\cuda\compiler.py", line 758, in __call__
kernel = self.specialize(*args)
File "D:\Python\lib\site-packages\numba\cuda\compiler.py", line 769, in specialize
kernel = self.compile(argtypes)
File "D:\Python\lib\site-packages\numba\cuda\compiler.py", line 784, in compile
kernel = compile_kernel(self.py_func, argtypes,
File "D:\Python\lib\site-packages\numba\core\compiler_lock.py", line 32, in _acquire_compile_lock
return func(*args, **kwargs)
TypeError: compile_kernel() got an unexpected keyword argument 'boundscheck'
Here is the function's body:
#jit(target ="cuda")
def testG(charNum, inpArray) -> null:
if charNum == 1:
arr2 = []
for s in range(len(inpArray)):
for i in range(len(alp)):
arr2.append(alp[i] + inpArray[s])
return
else:
print("more than 1")
arr2 = []
for s in range(len(inpArray)):
for i in range(len(alp)):
arr2.append(alp[i] + inpArray[s])
testG(charNum - 1, arr2)
I think it does have to do with the recursion but I really dont know.
Thanks for your help!
PS: The function works when not marked with #jit(target="cuda")
edited..
full traceback:
Traceback (most recent call last):
File "dscli.py", line 36, in <module>
main()
File "dscli.py", line 31, in main
instance_StreamingDownloader.download_all()
File "file.py", line 283, in download_all
time_first_frame_last_segment = self.get_time_saved_segment(crrt_segment - 1)
File "file.py", line 239, in get_time_saved_segment
return(start_time)
UnboundLocalError: local variable 'start_time' referenced before assignment
code here
It gets only first segment and then error.
How can I solve this issue?
code from github
the answer is quite simple -
the condition allows some case when start_time is not defined during script run
so as it is not defined - it fails
start_time is defined inside an if statement that's inside a for loop.
What if you don't enter the loop, or the condition isn't met? What should the function return?
start_time needs to be initialized (eg start_time = 0 / None / False) in the function body, outside any control flow clauses, so that it's always defined, and therefore you can always return it.
when condition isn't met then:
Traceback (most recent call last):
File "dscli.py", line 36, in <module>
main()
File "dscli.py", line 31, in main
instance_StreamingDownloader.download_all()
File "file.py", line 286, in download_all
lenght_ahead_buffered = time_first_frame_last_segment - time_if_streaming + random_perturbation
TypeError: unsupported operand type(s) for -: 'NoneType' and 'float'
line 280-286:
while continue_download:
time_first_frame_last_segment = self.get_time_saved_segment(crrt_segment - 1)
time_if_streaming = time.time() - init_time
random_perturbation = random.gauss(0, self.random_time)
if self.verbose > 1:
print("time in video if streaming: " + str(time_if_streaming))