POV-Ray : Newsgroups : povray.programming : POV pipes Server Time
28 Jul 2024 12:29:47 EDT (-0400)
  POV pipes (Message 1 to 8 of 8)  
From: Fabien HENON
Subject: POV pipes
Date: 8 Apr 2002 17:36:13
Message: <3CB20C6A.7080705@club-internet.fr>
I am writing an editor for POV that can fire up raytraces.

It is written with Tkinter (a GUI for Python).
I have been stuck for a week with a problem and can't get over it.
I asked a python newsgroup, but they were not able to help me.
I think the problem comes from the way POV outputs both the rendered 
line to the console and the raytraced image.
After the raytrace, there is still another output about the stats.


With the command below I can only get the credits as though I do a mere 
"x-povray". I don't get any picture.
Is there someone out there who can tell me how POV pipes its streams?
(pipe in, pipe out, pipe err,....)

Thanks
Here is the code


cmd= "/bin/sh x-povray +i/mnt/win_c/image/pov/7.pov +w320 +h240 -f +dgt"

pin,pout,perr=popen2.popen3(cmd) # three pipes are generated
				#  from this command

pipe_out=pout.readlines()      # this is the output


self.text.insert('end',pipe_out) # redirect the output to the Tkinter 						# 
application


Post a reply to this message

From: Fabien HENON
Subject: Re: POV pipes
Date: 8 Apr 2002 17:38:18
Message: <3CB20CE7.10109@club-internet.fr>
Fabien HENON wrote:

> I am writing an editor for POV that can fire up raytraces.
> 
> It is written with Tkinter (a GUI for Python).
> I have been stuck for a week with a problem and can't get over it.
> I asked a python newsgroup, but they were not able to help me.
> I think the problem comes from the way POV outputs both the rendered 
> line to the console and the raytraced image.
> After the raytrace, there is still another output about the stats.
> 
> 
> With the command below I can only get the credits as though I do a mere 
> "x-povray". I don't get any picture.
> Is there someone out there who can tell me how POV pipes its streams?
> (pipe in, pipe out, pipe err,....)
> 
> Thanks
> Here is the code
> 
> 
> cmd= "/bin/sh x-povray +i/mnt/win_c/image/pov/7.pov +w320 +h240 -f +dgt"
> 
> pin,pout,perr=popen2.popen3(cmd) # three pipes are generated
>                 #  from this command
> 
> pipe_out=pout.readlines()      # this is the output
> 
> 
> self.text.insert('end',pipe_out) # redirect the output to the 
> Tkinter                         # application
> 

I forgot to say : I use Linux ( with pipes that was nearly obvious)


Post a reply to this message

From: Ken Cecka
Subject: Re: POV pipes
Date: 8 Apr 2002 20:40:36
Message: <3cb23884@news.povray.org>
> With the command below I can only get the credits as though I do a mere
> "x-povray". I don't get any picture.

Is the lack of a picture the only problem?  It may be that the shell in 
which the x-povray command is getting spawned doesn't have a DISPLAY 
variable set.  If you're not familiar with the DISPLAY variable, try 
opening a terminal window, enter the command 'unset DISPLAY' at the prompt, 
then try running x-povray.  You will no longer get a picture window when 
x-povray runs.  For any X application do open a window, it needs to know 
where to display the window - this is usually done by reading the DISPLAY 
environment variable.  Typically, its value is ':0.0' which causes the 
window to be displayed on the machine where x-povray is running on xserver 
zero screen zero.  I don't know enough about python to know how the 
environment gets passed to your popen command, but a quick hack would be to 
change

cmd= "/bin/sh x-povray +i/mnt/win_c/image/pov/7.pov +w320 +h240 -f +dgt"

to

cmd= "/bin/sh -c '{ DISPLAY=:0.0; x-povray +i/mnt/win_c/image/pov/7.pov 
+w320 +h240 -f +dgt; }'"

A better solution would be to read the current value of the DISPLAY 
environment variable (not sure how to read environment variables in python) 
and pass that along instead.  There also might be a command-line flag to 
directly tell x-povray which display to use.

Ken


Post a reply to this message

From: PoD
Subject: Re: POV pipes
Date: 9 Apr 2002 10:00:50
Message: <3cb2f412$1@news.povray.org>
On Tue, 09 Apr 2002 07:02:26 +0930, Fabien HENON wrote:

> I am writing an editor for POV that can fire up raytraces.
> 
> It is written with Tkinter (a GUI for Python). I have been stuck for a
> week with a problem and can't get over it. I asked a python newsgroup,
> but they were not able to help me. I think the problem comes from the
> way POV outputs both the rendered line to the console and the raytraced
> image. After the raytrace, there is still another output about the
> stats.
> 
> 
> With the command below I can only get the credits as though I do a mere
> "x-povray". I don't get any picture.
> Is there someone out there who can tell me how POV pipes its streams?
> (pipe in, pipe out, pipe err,....)
> 
> Thanks
> Here is the code
> 
> 
> cmd= "/bin/sh x-povray +i/mnt/win_c/image/pov/7.pov +w320 +h240 -f +dgt"
> 
> pin,pout,perr=popen2.popen3(cmd) # three pipes are generated
> 				#  from this command
> 
> pipe_out=pout.readlines()      # this is the output
> 
> 
> self.text.insert('end',pipe_out) # redirect the output to the Tkinter
> 			# application

Maybe not entirely what you want but quite some time ago, just as an
experiment, I created a named pipe for each of POV's streams and catted
each of them in a seperate xterm, then ran POV with each stream
redirected to the appropriate pipe, and it worked fine.
One xterm had warnings, one had #DEBUG etc.

-- 
PoD.


Post a reply to this message

From: Fabien Hénon
Subject: Re: POV pipes
Date: 9 Apr 2002 16:09:51
Message: <3CB349AB.125C6F25@club-internet.fr>
Yes, I'd like to have a look at your script. It may help.
I might redirect all the streams into what I want.

Thanks
I look forward to hear from you.

Fabien



> On Tue, 09 Apr 2002 07:02:26 +0930, Fabien HENON wrote:
>
> > I am writing an editor for POV that can fire up raytraces.
> >
> > It is written with Tkinter (a GUI for Python). I have been stuck for a
> > week with a problem and can't get over it. I asked a python newsgroup,
> > but they were not able to help me. I think the problem comes from the
> > way POV outputs both the rendered line to the console and the raytraced
> > image. After the raytrace, there is still another output about the
> > stats.
> >
> >
> > With the command below I can only get the credits as though I do a mere
> > "x-povray". I don't get any picture.
> > Is there someone out there who can tell me how POV pipes its streams?
> > (pipe in, pipe out, pipe err,....)
> >
> > Thanks
> > Here is the code
> >
> >
> > cmd= "/bin/sh x-povray +i/mnt/win_c/image/pov/7.pov +w320 +h240 -f +dgt"
> >
> > pin,pout,perr=popen2.popen3(cmd) # three pipes are generated
> >                               #  from this command
> >
> > pipe_out=pout.readlines()      # this is the output
> >
> >
> > self.text.insert('end',pipe_out) # redirect the output to the Tkinter
> >                       # application
>
> Maybe not entirely what you want but quite some time ago, just as an
> experiment, I created a named pipe for each of POV's streams and catted
> each of them in a seperate xterm, then ran POV with each stream
> redirected to the appropriate pipe, and it worked fine.
> One xterm had warnings, one had #DEBUG etc.
>
> --
> PoD.


Post a reply to this message

From: Fabien Hénon
Subject: Re: POV pipes
Date: 9 Apr 2002 16:10:18
Message: <3CB349C6.5E451205@club-internet.fr>
Yes, I'd like to have a look at your script. It may help.
I might redirect all the streams into what I want.

Thanks
I look forward to hear from you.

Fabien



> On Tue, 09 Apr 2002 07:02:26 +0930, Fabien HENON wrote:
>
> > I am writing an editor for POV that can fire up raytraces.
> >
> > It is written with Tkinter (a GUI for Python). I have been stuck for a
> > week with a problem and can't get over it. I asked a python newsgroup,
> > but they were not able to help me. I think the problem comes from the
> > way POV outputs both the rendered line to the console and the raytraced
> > image. After the raytrace, there is still another output about the
> > stats.
> >
> >
> > With the command below I can only get the credits as though I do a mere
> > "x-povray". I don't get any picture.
> > Is there someone out there who can tell me how POV pipes its streams?
> > (pipe in, pipe out, pipe err,....)
> >
> > Thanks
> > Here is the code
> >
> >
> > cmd= "/bin/sh x-povray +i/mnt/win_c/image/pov/7.pov +w320 +h240 -f +dgt"
> >
> > pin,pout,perr=popen2.popen3(cmd) # three pipes are generated
> >                               #  from this command
> >
> > pipe_out=pout.readlines()      # this is the output
> >
> >
> > self.text.insert('end',pipe_out) # redirect the output to the Tkinter
> >                       # application
>
> Maybe not entirely what you want but quite some time ago, just as an
> experiment, I created a named pipe for each of POV's streams and catted
> each of them in a seperate xterm, then ran POV with each stream
> redirected to the appropriate pipe, and it worked fine.
> One xterm had warnings, one had #DEBUG etc.
>
> --
> PoD.


Post a reply to this message

From: Fabien Hénon
Subject: Re: POV pipes
Date: 9 Apr 2002 16:14:16
Message: <3CB34AB3.4099C290@club-internet.fr>
Actually the problem not merely the lack of picture.
I never managed to get both the stats(eg output to the console) and the
picture.
It was always either the picture or the output to the console.

Anyway I'll give your tip a try.
Thanks

Fabien




> > With the command below I can only get the credits as though I do a mere
> > "x-povray". I don't get any picture.
>
> Is the lack of a picture the only problem?  It may be that the shell in
> which the x-povray command is getting spawned doesn't have a DISPLAY
> variable set.  If you're not familiar with the DISPLAY variable, try
> opening a terminal window, enter the command 'unset DISPLAY' at the prompt,
> then try running x-povray.  You will no longer get a picture window when
> x-povray runs.  For any X application do open a window, it needs to know
> where to display the window - this is usually done by reading the DISPLAY
> environment variable.  Typically, its value is ':0.0' which causes the
> window to be displayed on the machine where x-povray is running on xserver
> zero screen zero.  I don't know enough about python to know how the
> environment gets passed to your popen command, but a quick hack would be to
> change
>
> cmd= "/bin/sh x-povray +i/mnt/win_c/image/pov/7.pov +w320 +h240 -f +dgt"
>
> to
>
> cmd= "/bin/sh -c '{ DISPLAY=:0.0; x-povray +i/mnt/win_c/image/pov/7.pov
> +w320 +h240 -f +dgt; }'"
>
> A better solution would be to read the current value of the DISPLAY
> environment variable (not sure how to read environment variables in python)
> and pass that along instead.  There also might be a command-line flag to
> directly tell x-povray which display to use.
>
> Ken


Post a reply to this message

From: PoD
Subject: Re: POV pipes
Date: 10 Apr 2002 08:01:31
Message: <3cb4299b@news.povray.org>


> Yes, I'd like to have a look at your script. It may help. I might
> redirect all the streams into what I want.
> 
> Thanks
> I look forward to hear from you.
> 
> Fabien
> 

Well I don't have a script as such, I just did

mkfifo povdebug povfatal povrender povstats povwarning

started 5 xterms
xterm 1: cat povdebug
xterm 2: cat povfatal
etc.

run povray with these options added 
+GDpovdebug +GFpovfatal +GRpovrender +GSpovstats +GWpovwarning

You could easily open each fifo in your python script and display the
output of each in a text widget.


Hope this helps.

-- 
PoD.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.