Help with CGI script. 
Author Message
 Help with CGI script.

Hi!

I am having problems with a CGI script serving VRML.

THe CGI script is in python and I am using Apache to serve it (and
Apache is serving .wrl files OK)

The simplest script is something like:

print "Content-type: model/vrml"
print "Pragma: no-cache"
print

fln = "fog.wrl"
file = open( fln, "r" )
buff = file.read()
file.close()
print buff

The file displays OK if I use http://www.*-*-*.com/

But using CGI I only get a blank screen.

My vrml browser is ParallelGraphics Cortona pluged into MSIE.

Any ideas of what I might be doing wrong?

Best regards
Jos Rui

--
========================================================================
What is a cynic? A man who knows the price of everything and the value
of nothing. - Oscar Wilde.
========================================================================
Iam://Jos Rui Faustino de Sousa http://www.*-*-*.com/ ~jrfsousa/

address://rua Carlos A. Pinto de Abreu no 30C, 1o 3040 Coimbra Portugal
========================================================================
Real Programmers do sig blocks in fortran 95.
========================================================================



Wed, 01 Oct 2003 08:16:23 GMT  
 Help with CGI script.



Quote:
> Hi!
[snip]

> print "Content-type: model/vrml"
> print "Pragma: no-cache"
> print

> fln = "fog.wrl"
> file = open( fln, "r" )

perhaps you need:

file=open(fln,"rb")

[snip]

Quote:

> But using CGI I only get a blank screen.

Then the CGI is certainly sending something different than what you get with
the static file.  What happens if you *link* to the CGI, and then choose to
save the link rather than opening it?  Odds are it is sending something
strange, like the VRML file header followed by the entire file with no
newlines, thus making the entire file look like a comment to the browser.

--Steve



Wed, 01 Oct 2003 10:50:14 GMT  
 Help with CGI script.

Quote:
> file=open(fln,"rb")

Makes no difference I tryed it before in the command line and it chugged
out the .wrl file properly...

Like:

Content-type: model/vrml
Pragma: no-cache

#VRML V2.0 utf8

Fog {
        color 1.0 1.0 1.0
        fogType "EXPONENTIAL"
        visibilityRange 20.0

Quote:
}

Background {skyColor 1.0 1.0 1.0 }

(a lot more sniped)

Quote:
> What happens if you *link* to the CGI, and then choose to
> save the link rather than opening it?

The browser saves as a .wrl file and inside is a perfectly good vrml
code wich I can open afterwards with no problem with the VRML browser.

Quote:
>  Odds are it is sending something
> strange, like the VRML file header followed by the entire file with no
> newlines

The brownser seams to be able to recognize the file type as VRML so I
expected it should be getting the headers properly as it defaults to
.wrl type file and the code inside is perfectly well formed with the
proper newlines exactly like the original file.

Best regards
Jos Rui

--
========================================================================
College professors are suspect because whenever emotion is in control,
anti-intellectualism prevails. - Gordon W. Allport.
========================================================================
Iam://Jos Rui Faustino de Sousa http://homepage.esoterica.pt/~jrfsousa/

address://rua Carlos A. Pinto de Abreu no 30C, 1o 3040 Coimbra Portugal
========================================================================
Real Programmers do sig blocks in Fortran 95.
========================================================================



Wed, 01 Oct 2003 19:17:24 GMT  
 Help with CGI script.
I'm stumped then.  Can you throw up working links to both the CGI and the
static world?  Maybe somebody else on this list can help you.

--Steve



Thu, 02 Oct 2003 03:09:11 GMT  
 Help with CGI script.
The kindly Rev. overheard "Jos Rui Faustino de Sousa"

Quote:
>Makes no difference I tryed it before in the command line and it
>chugged out the .wrl file properly...

How about:

#!/bin/sh
echo "Content-type: text/html"
echo "Pragma: no-cache"
echo ""
cat fog.wrl

--
Rev. Bob "Bob" Crispen
crispen at hiwaay dot net

Chaos, panic, & disorder - my work here is done.



Fri, 03 Oct 2003 12:38:10 GMT  
 Help with CGI script.


Quote:
> I'm stumped then

I will try another VRML browser and see what happens...

Quote:
> Can you throw up working links to both the CGI and the
> static world?

Unfortunately not. I do not have a "real" connection to the internet...

Thank you very much.

Best regards
Jos Rui

--
========================================================================
It cannot be intellectually honest to undertake to teach a subject but
to omit its most important principle. It [teaching biology without
evolution] would, nowadays, be like teaching physics but leaving out
atoms. - George Gaylord Simpson.
========================================================================
Iam://Jos Rui Faustino de Sousa http://homepage.esoterica.pt/~jrfsousa/

address://rua Carlos A. Pinto de Abreu no 30C, 1o 3040 Coimbra Portugal
========================================================================
Real Programmers do sig blocks in Fortran 95.
========================================================================



Sat, 04 Oct 2003 19:37:56 GMT  
 Help with CGI script.


Quote:


> > file=open(fln,"rb")

> Makes no difference I tryed it before in the command line and it chugged
> out the .wrl file properly...

> Like:

> Content-type: model/vrml
> Pragma: no-cache

> #VRML V2.0 utf8

> Fog {
>         color 1.0 1.0 1.0
>         fogType "EXPONENTIAL"
>         visibilityRange 20.0
> }

> Background {skyColor 1.0 1.0 1.0 }

> (a lot more sniped)

> > What happens if you *link* to the CGI, and then choose to
> > save the link rather than opening it?

> The browser saves as a .wrl file and inside is a perfectly good vrml
> code wich I can open afterwards with no problem with the VRML browser.

> >  Odds are it is sending something
> > strange, like the VRML file header followed by the entire file with no
> > newlines

> The brownser seams to be able to recognize the file type as VRML so I
> expected it should be getting the headers properly as it defaults to
> .wrl type file and the code inside is perfectly well formed with the
> proper newlines exactly like the original file.

> Best regards
> Jos Rui

> --

Hi,
i've loaded some testfiles in my BS/Browser/VR-Viewer configuration (W9x/NS4.75/Cosmo2.1) and
get only this header work (local):

#VRML V2.0 utf8
#Content-type: model/vrml
#Pragma: no-cache
...

not working are:
#Content-type: model/vrml
#Pragma: no-cache
#VRML V2.0 utf8
and:
Content-type: model/vrml
Pragma: no-cache
#VRML V2.0 utf8

I think the "#commented Metatags" in the .wrl file have no effect. It seems to be a
Apache-config problem and the  "forcetype"-option solve it. Place the python-scripts which
serves vrml-content in an extra folder. More details at:
http://httpd.apache.org/docs/mod/mod_mime.html#forcetype
Maybe you have to add it to the cgi-folder-option too. (Info around the link above).

--eb



Sun, 05 Oct 2003 05:21:38 GMT  
 Help with CGI script.

Quote:
> #!/bin/sh

Windows here... No sh... ;-)

Closest thing batch files:

echo Content-type: model/vrml
echo Pragma: no-cache
echo.
type fog.wrl

This works OK.

Now it seams that the problem is really with the python script...

I have tryed:

Content-type: text/html

I get an improperly formated .wrl file.

But I would say the problem here is with html... no <br> or <p></p> to
separate lines...

And:

Content-type: text/plain

I get the properly formated .wrl file.

No idea what might be wrong...

Best regards
Jos Rui

--
========================================================================
The greatest dangers to liberty lurk in insidious encroachment by men of
zeal, well meaning but without understanding. - Louis Brandeis.
========================================================================
Iam://Jos Rui Faustino de Sousa http://homepage.esoterica.pt/~jrfsousa/

address://rua Carlos A. Pinto de Abreu no 30C, 1o 3040 Coimbra Portugal
========================================================================
Real Programmers do sig blocks in Fortran 95.
========================================================================



Sun, 05 Oct 2003 05:28:40 GMT  
 Help with CGI script.
Hi again,
maybe a syntax error

Content-Type = "Content-Type" ":" media-type NL
(from:
http://CGI-Spec.Golux.Com/cgi-120-00a.html#8.0
)

Important is the space between "Content-Type" ":"
missing in your posting.

eb

PS: Can't test it, because no Apache working here today.

.



Sun, 05 Oct 2003 06:02:05 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. need help with cgi script

2. Need help (Tcl cgi scripts how to?)

3. Please Help with CGI Script!

4. Invoke cgi from cgi script

5. Help needed with CGI Script

6. HELP!! c-script for forms (cgi)

7. Last Problem, I Think, In CGI Script: Please Help

8. Need help on configuring IIS to run jython-scripts (CGI)

9. Help with 500 error on cgi script

10. Newbie needs help on Python CGI scripts

11. Problems running cgi-scripts in python1.5 (help!)

12. cgi-script in fortran-HELP PLEASE

 

 
Powered by phpBB® Forum Software