I'm trying to generate images using Paraview in a non-interactive PBS job on a remote linux machine. From the command-line, if I have a file called cone.py with the following contents
from paraview.simple import *
Cone()
Show()
SaveScreenshot('cone.png')
and I type pvpython cone.py in the command-line, then a window pops up showing me the image of the cone, and the image is saved. I don't want the window to pop up. It does even if I use pvbatch cone.py or pvbatch cone.py --use-offscreen-rendering. If I try to run this code from within a PBS job, the image isn't generated (probably because it can't generate the window) and the following error message is generated:
ERROR: In /home/kitware/Dashboards/buildbot/paraview-debian4dash-linux-shared-release_qt4_superbuild/source-paraview/VTK/Rendering/OpenGL/vtkXOpenGLRenderWindow.cxx, line 542
vtkXOpenGLRenderWindow (0x139559c0): bad X server connection. DISPLAY=/var/spool/PBS/mom_priv/jobs/1443323.rrlogin.internal.SC: line 8: 21926 Aborted pvbatch cone.py
/home/kitware isn't a valid directory on my machine. Any help would be appreciated.
If your remote Linux machine has X installed you need to set your DISPLAY variable before running pvbatch. If your remote Linux machine doesn't have X installed you'll need to build with OSMesa (info and directions here).
Looks like you are using the official ParaView binaries for a non-interactive PBS job which doesn't have an accessible X server. You have two options:
Check with your site admins to see if there's a way to start up an X server with your job. This would be typically the case if your remote machine has GPUs.
Build ParaView from source with OSMesa (which stands for offscreen-Mesa) support. Check out this wiki page for details. Also refer to this blog post if you're building ParaView 5.0 or later with OpenGL2 backend. This will work on systems without an accessible X server.
You cannot use the binaries distributed at paraview.org on X-less systems. --use-offscreen-rendering still requires access to an X server to create the OpenGL context unless build with OSMesa support (in which case the command line option is not necessary). If you are wondering why the command line option then? It's to avoid creating a popup window on X-enabled systems.
Related
I have a few personal helper applications written in Python that communicate with me either through the Windows 10 taskbar area on the right (where the icons are - mine below is the red and blue square), or the Windows 10 Notification Center.
They currently run in a minimized shortcut (that points to python.exe) and I would like to remove them from the taskbar
The solution I am looking at is to run them as services. I created one (through nssm) and started the service that runs my program (via the Local Service account, which allows me to (hopefully) interact with the desktop). Unfortunately, I get
I allowed MY-COMPUTER-NAME$ to access the working directory of the code, as well as to the script itself.
Is there something else I should allow for the script to successfully run?
(Note: the service started when I used my account, but the taskbar icon started from my program did not show up)
I once used this command in cmd to run a service that is designed in python. follow this
sc create WojAPP binPath= "C:\Python34\Python.exe -- C:\tmp\yourpythonscript.py"
[reference]When creating a service with sc.exe how to pass in context parameters?
I want to manage virtual machines (any flavor) using Python scripts. Example, create VM, start, stop and be able to access my guest OS's resources.
My host machine runs Windows. I have VirtualBox installed. Guest OS: Kali Linux.
I just came across a software called libvirt. Do any of you think this would help me ?
Any insights on how to do this? Thanks for your help.
For aws use boto.
For GCE use Google API Python Client Library
For OpenStack use the python-openstackclient and import its methods directly.
For VMWare, google it.
For Opsware, abandon all hope as their API is undocumented and has like 12 years of accumulated abandoned methods to dig through and an equally insane datamodel back ending it.
For direct libvirt control there are python bindings for libvirt. They work very well and closely mimic the c libraries.
I could go on.
follow the directions here to install docker https://docs.docker.com/windows/ (it includes Oracle VirtualBox (if you dont already have it)
#grab the immage
docker pull kalilinux/kali-linux-docker
#run a specific command
docker run kalilinux/kali-linux-docker <some_command>
#open interactive terminal to "docker image"
docker run -t -i kalilinux/kali-linux-docker /bin/bash
if you want to mount a local volume you can use the `-v dst src` switch in your run command
#mount local ./training/webapp directory into kali image # /webapp
docker run kalilinux/kali-linux-docker -v /webapp training/webapp <some_command>
note that these are run from the regular windows prompt to use python you would need to wrap them in subprocess calls ...
In our company we using vagrant VM's to have the save env. for all. Is it possible to configure VisualStudio + PTVS (python tools for VS) to use vagrant based python interpreter via ssh for example?
There's no special support for remote interpreters in PTVS, like what PyCharm has. It's probably possible to hack something based on the existing constraints, but it would be some work...
To register an interpreter that can actually run, it would have to have a local (well, CreateProcess'able - so e.g. SMB shares are okay) binary that accepts the same command line options as python.exe. It might be possible to use ssh directly by adding the corresponding command line options to project settings. Otherwise, a proxy binary that just turns around and invokes the remote process would definitely work.
Running under debugger is much trickier. For that to work, the invoked Python binary would also have to be able to load the PTVS debugging bits (which is a bunch of .py files in PTVS install directory), and to connect to VS over TCP to establish a debugger connection. I don't see how this could be done without writing significant amounts of code to correctly proxy everything.
Attaching to a remotely running process using ptvsd, on the other hand, would be trivial.
For code editing experience, you'd need a local copy (or a share etc) of the standard library for that interpreter, so that it can be analyzed by the type inference engine.
I would like to run some Windows binaries from a network share to remove update and installation issues across our large collection of test and developer machines. The specific package in question is Pytest. I have a copy of python (2.7.6) installed on the network share and it works fine. Using this python, I installed pytest onto the network share using my account. My account is special because it's the only one with read/write access to the network share--all other accounts have read-only access.
After installing pytest, I ran the executable py.test.exe in the Scripts directory and it was able to run
X:\python\2.7.6\windows\x86>Scripts\py.test.exe
============================= test session starts =============================
platform win32 -- Python 2.7.6 -- py-1.4.20 -- pytest-2.5.2
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! KeyboardInterrupt !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
X:\python\2.7.6\windows\x86\lib\ntpath.py:401: KeyboardInterrupt
============================== in 18.30 seconds ==============================
X:\python\2.7.6\windows\x86>
However, other users cannot run this executable, and get the message
failed to create process
If pytest is installed on a local drive there is no problem. I have performed the following experiments:
Run py.test locally as an administrator: works
Run py.test locally as a regular user: fails to create process
Run from network share using my special id: works
Run from network share using 'regular' id (which has Administrator rights on that PC): fails to create process
Run from network share using 'regular' id and specifically run in a window as Administrator: fails to create process
I had a couple of theories that the py.test.exe must be
Run as administrator and possibly
Run from a directory with read/write permissions
I tried sorting all files in the network folder by time stamp to see if perhaps there was some file (like a .pid) being created that was stymied by the read-only nature of the network share, but I didn't see anything, so the read/write aspect may not be applicable. So, it appears that somehow binaries running from a network share are not run with administrator privileges, except for my special id.
Anyone know why and how I can address this? Using EnableLinkedConnections GPO seemed to be related but the symptom is different and in fact did not help.
Any suggestions on how to further diagnose the problem?
I am writing a script in python, and part of it needs to connect to a remote computer using rdp. Is there a script or an api that I could use to create this function? Also, if there is not, is there a way to package a rdp application along side python and then use a python script to run it? Any help would be much appreciated. Thanks in advance, Nate
If you need an interactive window, use the subprocess module to start your rdesktop.exe (or whatever).
If you need to run some command automatically, you're probably better off forgetting about RDP and using ssh (with passwordless, passphraseless authentication via RSA or similar), psexec (note that some antivirus programs may dislike psexec, not because it's bad, but because it's infrequently been used by malware for bad purposes) or WinRM (this is what you use in PowerShell; it's like ssh or psexec, except it serializes objects on the sender, transmits, and deserializes back to an object on the recipient).
Given a choice among the 3, I'd choose ssh. Cygwin ssh works fine, but there are several other implementations available for Windows.
HTH
As per this GitHub comment, you can try to use libfreerdp via ctypes in Python.
See: FreeRDP library at GitHub which is a free remote desktop protocol library and clients.
Home page: www.freerdp.com
Related: Programmatically manipulating active RDP session.