0

I am trying to run a simple code in vpython to check if everything works ok with the module. My code looks like:

from vpython import *

scene=canvas()
scene.width=550
scene.height=550
scene.height=580
scene.range=2
ball=sphere(pos=vec(0,0,0),radius=0.8,color=color.orange) 

I run it using command: python3 foo.py. However after that, the program is freezing and when I kill the process I receive the following traceback:

   Exception ignored in: <bound method standardAttributes.__del__ of <vpython.vpython.sphere object at 0x7f25192959e8>>
Traceback (most recent call last):
  File "/home/kuba_unix/.local/lib/python3.5/site-packages/vpython/vpython.py", line 1105, in __del__
    super(standardAttributes, self).__del__()
  File "/home/kuba_unix/.local/lib/python3.5/site-packages/vpython/vpython.py", line 315, in __del__
    cmd = {"cmd": "delete", "idx": self.idx}
AttributeError: 'sphere' object has no attribute 'idx'

But I do not know if that is the problem. I am working on Windows 10 and use Windows Subsystem for Linux. For plotting, I use Xming window and set in the bash console the display using export DISPLAY=:0. Until today I did not encounter any problems with plotting (gnuplot and matplotlib work perfectly fine). For additional information, I am using Python 3.5.2 and the version of vpython is ['7.5.0', 'jupyter'] (importing the module does not raise any errors). The result of this program should look like in this example.

4
  • Are you using Windows Subsystem for Linux?
    – Biswapriyo
    Commented May 9, 2019 at 12:07
  • @Biswapriyo No I have a linux bash shell for windows howtogeek.com/249966/…
    – rodrykbyk
    Commented May 9, 2019 at 12:24
  • @Biswapriyo Okay sorry i am using this one then on the second look, just did not know the excact name
    – rodrykbyk
    Commented May 9, 2019 at 12:34
  • @Biswapriyo i checked if it is working in virtualbox. It works fine but the problem may be that it opens in default browser ibb.co/PmcCM13
    – rodrykbyk
    Commented May 9, 2019 at 13:18

1 Answer 1

0

Steps required:

  • Install packages: sudo apt install python3 python3-pip
  • Install vpython module: pip3 install --user vpython
  • Run the python file: python3 ./foo.py
  • Get the TCP/IP port number from netstat -abno command in Command Prompt. Or use Resource Monitor, TCPView from Sysinternals etc. for GUI. Here is a screenshot from ResMon:

resmon-opend-ports-python]

  • Open any browser in Windows. Type the URL as localhost:port_number. For example, in image localhost:49669. The first port is for viewing image and later one is to close the connection.

The images is served in a TCP/IP link. So, Xserver is not required here. Although Windows Firewall may not block the connection the port can be opened in firewall (if it is blocked).

1
  • Okay thanks alot for figuring this out! Everything seems working now.
    – rodrykbyk
    Commented May 9, 2019 at 18:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .