Re: [Tutor] Fwd: Re: Help me out please

2016-07-21 Thread Alan Gauld via Tutor
On 21/07/16 21:17, Danny Yoo wrote:

> Well, I have two scripts. One in Python and the other one in html.
> Inside the html's script you can find out these lines:
> 
> 
> initLatencymon(
> '#latencyMON',
> {},
> { measurements:[*3679333, 3793762*]}
> );
> 
> 
> I need to change these *bold *variables from the Python's script. 

That's technically not too difficult at a file level, especially if
you use an html parser like Beautiful Soup. But whether that's the
best way depends on how the files are used.

How is the html file accessed? Is it independent of the python script?
In other words doers the python script run as a batch job that only
updates the values occasionally? Or regularly? (How often?) or is it on
demand - some other trigger starts the Python script?
Or does the Python script somehow start from an action by the html script?

Its all very vague just saying you have two files.
WE need to understand the intended interaction between them.

If it is just a daily or hourly update then the html parser
route is probably adequate. If its driven by an external
trigger then it might be ok but might not.

And if its driven by the html script itself then we almost
certainly need a redesign of how you are doing things.

So can you start by explaining the use case scenario
for these interactions. How do the file get executed?
What triggers them?

How do they interact (if, indeed, they do)?

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] Fwd: Re: Help me out please

2016-07-21 Thread Danny Yoo
Apologies: I don't have time at the moment to answer.  Forwarding to the
mailing list!
-- Forwarded message --
From: "Marc Sànchez Quibus" 
Date: Jul 21, 2016 12:08 AM
Subject: Re: [Tutor] Help me out please
To: "Danny Yoo" 
Cc:

Thanks for your fast reply. I'm gonna explain a little bit more about my
problem to be more understood.
Well, I have two scripts. One in Python and the other one in html.
Inside the html's script you can find out these lines:


initLatencymon(
'#latencyMON',
{},
{ measurements:[*3679333, 3793762*]}
);


I need to change these *bold *variables from the Python's script. Inside
this one, there are just some prints, system's functions and so on. I would
like to create, at least, some variable in python to select the value of
the varible in HTML. Better if it could be chosen as input( ). Either some
variable or a function. If you need more infromation let me know.
Thanks in advance.
Marc

2016-07-21 7:38 GMT+02:00 Danny Yoo :

> On Tue, Jul 19, 2016 at 4:31 AM, Marc Sànchez Quibus
>  wrote:
> > Hi,
> > First of all I'm gonan introduce myself. My name is Marc and I'm a
> student
> > and also a python's programmer begginer. I've been studying/learning
> python
> > and now I need some help to finish my project.
> > I have two scripts, one of them in python (the main script) and the other
> > one written in html. Well, is just a brief javascript (an app) that I
> took
> > by Github. I need to change a variable inside this html script. I was
> > wondering wether I could change this variable from my python script or
> not.
> > Is there some way to do it?
>
> Hi Marc,
>
> Yes.  You might want to read something like this to get some
> background.  Phil Greenspun's Guide to Web Publishing:
>
> http://philip.greenspun.com/panda/
>
> Specifically, the chapter "Sites that are really progarms".
>
> http://philip.greenspun.com/panda/server-programming
>
> You mentioned that you have two scripts, one in Python and the other in
> HTML.
>
> A web site can be seen as this: something that (1) takes in a web
> request sent by a browser, and (2) spits out a web response.
>
> A static web site takes in a web request, looks for an appropriate
> file, and prints that file back as a web response.  But that's not the
> only way we can build web responses.  A programmatic web site can take
> that request and *generate* a web page on the fly.  A web site can
> actually be a program: not just a plain text file.
>
>
> There are a lot of resources to teach how to write programs that serve
> web sites.  Another by the same author is
> http://philip.greenspun.com/seia/, which goes into a lot more detail.
>



-- 
*Marc Sànchez Quibus*
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor