pptk icon indicating copy to clipboard operation
pptk copied to clipboard

record method gives ConnectionRefusedError: [WinError 10061] after 52 frames

Open tddaniel opened this issue 6 years ago • 3 comments

When I try and use the record method on windows I get this error after 52 frames.

ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it

I think it has to do with how many/how rapidly new tcp connections are being made to save the screen shots and windows not liking/handling things correctly. it works as long as I don't try and save more than 52 frames. I don't know about very much about sockets etc so any help is appreciated.

It works fine on my linux machine.

Minimal code to reproduce.

import numpy as np
import pptk 
x = np.random.rand(100,3)
poses = []
for i in range(5):
    poses.append([0, 0, 0, i* np.pi/2, np.pi/4, 5])
v = pptk.viewer(x, x[:,-1])
v.set(point_size=0.01)
v.record('recording', poses, ts=np.linspace(0,1,len(poses)), fps=200)

tddaniel avatar Jul 25 '19 17:07 tddaniel

I forked the project and change some stuff in record() function Tose may solve your problem (the last commit i did introduce wait between each screenshot for fine render) I didn't compiled it for windows so i can't confirm. https://github.com/3dsman/pptk

3dsman avatar Aug 15 '19 20:08 3dsman

I get the same error periodically without the record function using one of the basic tutorials:

import numpy as np import pptk

s = np.linspace(0.0, 2 * np.pi, 1000)[None, :] t = np.linspace(-1.0, 1.0, 50)[:, None]

x = (1 + 0.5 * t * np.cos(0.5 * s)) * np.cos(s) y = (1 + 0.5 * t * np.cos(0.5 * s)) * np.sin(s) z = 0.5 * t * np.sin(0.5 * s) P = np.stack([x, y, z], axis=-1)

N = np.cross(np.gradient(P, axis=1), np.gradient(P, axis=0)) N /= np.sqrt(np.sum(N ** 2, axis=-1))[:, :, None]

v = pptk.viewer(P) v.attributes(0.5 * (N.reshape(-1, 3) + 1)) v.set(point_size=0.001)

nigeljw1 avatar Aug 20 '19 09:08 nigeljw1

@nigeljw1 try using v = pptk.viewer(P,debug=True) it seemed to help as a temporary fix.

@3dsman Thanks I will give it a try this weekend to see if that fixes things. In the mean time, as mention above, I did find that setting debug=True when creating the viewer seems to fix it as well. I guess that means that the stderr output on windows has issues when a pipe is used? As far as I can tell the debug flag only affects the following line in the viewer.py file

self._process = subprocess.Popen(
            [os.path.join(_viewer_dir, 'viewer'), str(s.getsockname()[1])],
            stdout=subprocess.PIPE,
            stderr=(None if debug else subprocess.PIPE))

I haven't had time to look into why the stderr ouput being a pipe causes this issue and it might be a week or two until I can spend anymore time on it.

tddaniel avatar Aug 21 '19 01:08 tddaniel