I'm trying to do the following. I have a Python application that is
run:
python app1.py --location=c:\tes t1
What I want to do is save the location parameter, so I can then do (in
the same window):
python app2.py
And have app2.py automatically have access to the value of "location".
Now, the difficult part is, that in another window I want to do:
python app1.py --location=c:\tes t2
python app2.py
And have app2.py automatically get c:\test2 as the location. So the
two windows (consoles) are isolated from each other.
I thought I could use os.environ, but that doesn't save the variable
for applications that are run afterwards in the same window.
Any suggestions?
Thanks 14 1417
On 9/16/07, Stodge <st****@gmail.c omwrote:
python app1.py --location=c:\tes t1
What I want to do is save the location parameter, so I can then do (in
the same window):
python app2.py
And have app2.py automatically have access to the value of "location".
Do app1.py to save a pickle of the value you want app2 to read.
--
Sebastián Bassi (セバステ アン). Diplomado en Ciencia y Tecnolog*a.
Curso Biologia molecular para programadores: http://tinyurl.com/2vv8w6
GPG Fingerprint: 9470 0980 620D ABFC BE63 A4A4 A3DE C97D 8422 D43D
Good idea, but I can't guarantee that the two scripts will be run from
the same directory - so where to store the pickle?
On Sep 16, 5:25 pm, "Sebastian Bassi" <sba...@clubdel arazon.org>
wrote:
On 9/16/07, Stodge <sto...@gmail.c omwrote:
python app1.py --location=c:\tes t1
What I want to do is save the location parameter, so I can then do (in
the same window):
python app2.py
And have app2.py automatically have access to the value of "location".
Do app1.py to save a pickle of the value you want app2 to read.
--
Sebastin Bassi ( ). Diplomado en Ciencia y Tecnologa.
Curso Biologia molecular para programadores:http://tinyurl.com/2vv8w6
GPG Fingerprint: 9470 0980 620D ABFC BE63 A4A4 A3DE C97D 8422 D43D
On 9/17/07, Stodge <st****@gmail.c omwrote:
Good idea, but I can't guarantee that the two scripts will be run from
the same directory - so where to store the pickle?
It doesn't matter if is the same directory or not, as long as both
programs has access to the pickle file (one program should have write
access and the other program should have at least read access).
--
Sebastián Bassi (セバステ アン). Diplomado en Ciencia y Tecnolog*a.
Curso Biologia molecular para programadores: http://tinyurl.com/2vv8w6
GPG Fingerprint: 9470 0980 620D ABFC BE63 A4A4 A3DE C97D 8422 D43D
Stodge a crit :
I'm trying to do the following. I have a Python application that is
run:
python app1.py --location=c:\tes t1
What I want to do is save the location parameter, so I can then do (in
the same window):
python app2.py
And have app2.py automatically have access to the value of "location".
Now, the difficult part is, that in another window I want to do:
python app1.py --location=c:\tes t2
python app2.py
And have app2.py automatically get c:\test2 as the location. So the
two windows (consoles) are isolated from each other.
I thought I could use os.environ, but that doesn't save the variable
for applications that are run afterwards in the same window.
Any suggestions?
May use simple file in known place:
$HOME/.myprefs
$HOME/.conf/myprefs
Or host specific configuration API:
WindowsRegistry HKEY_CURRENT_US ER\Software\MyS ociety\MyApp\my prefs
See os.getenv, and _winreg Windows specific module.
See also standard ConfigParser module
Hope you know how to read/write files.
Stodge a crit :
I'm trying to do the following. I have a Python application that is
run:
python app1.py --location=c:\tes t1
What I want to do is save the location parameter, so I can then do (in
the same window):
python app2.py
And have app2.py automatically have access to the value of "location".
Now, the difficult part is, that in another window I want to do:
python app1.py --location=c:\tes t2
python app2.py
And have app2.py automatically get c:\test2 as the location. So the
two windows (consoles) are isolated from each other.
I thought I could use os.environ, but that doesn't save the variable
for applications that are run afterwards in the same window.
Any suggestions?
Yes : pass the same arg to both app1.py and app2.py !-)
Braindead, I know, but still the simplest solution.
You're probably right!
Thanks all. :)
On Sep 17, 10:15 am, Bruno Desthuilliers <bruno.
42.desthuilli.. .@wtf.websitebu ro.oops.comwrot e:
Stodge a crit :
I'm trying to do the following. I have a Python application that is
run:
python app1.py --location=c:\tes t1
What I want to do is save the location parameter, so I can then do (in
the same window):
python app2.py
And have app2.py automatically have access to the value of "location".
Now, the difficult part is, that in another window I want to do:
python app1.py --location=c:\tes t2
python app2.py
And have app2.py automatically get c:\test2 as the location. So the
two windows (consoles) are isolated from each other.
I thought I could use os.environ, but that doesn't save the variable
for applications that are run afterwards in the same window.
Any suggestions?
Yes : pass the same arg to both app1.py and app2.py !-)
Braindead, I know, but still the simplest solution.
On Sep 17, 6:39 am, Laurent Pointal
May use simple file in known place:
$HOME/.myprefs
$HOME/.conf/myprefs
Or host specific configuration API:
WindowsRegistry HKEY_CURRENT_US ER\Software\MyS ociety\MyApp\my prefs
See os.getenv, and _winreg Windows specific module.
See also standard ConfigParser module
Also, os.path offers expanduser(). The following is reasonably
portable:
import os
user_home_dir = os.path.expandu ser("~")
--
--Bryan
os.path.expandu ser isn't an option; I need each console/window to
maintain different values which I wouldn't get from saving to a user's
home directory. Unless I used a different file for each console/window
but that just gets me into the same situation I'm already in. I think
the only option is to set environment variables using another script.
I'm really surprised and disapponited by this.
One option I thought of but haven't investigated, is the ability to
get the parent (i.e. console's) process id and use that to create a
file somewhere. Not sure if this is even possible.
On Sep 17, 4:29 pm, bryanjugglercry ptograp...@yaho o.com wrote:
On Sep 17, 6:39 am, Laurent Pointal
May use simple file in known place:
$HOME/.myprefs
$HOME/.conf/myprefs
Or host specific configuration API:
WindowsRegistry HKEY_CURRENT_US ER\Software\MyS ociety\MyApp\my prefs
See os.getenv, and _winreg Windows specific module.
See also standard ConfigParser module
Also, os.path offers expanduser(). The following is reasonably
portable:
import os
user_home_dir = os.path.expandu ser("~")
--
--Bryan
Stodge a crit :
os.path.expandu ser isn't an option; I need each console/window to
maintain different values which I wouldn't get from saving to a user's
home directory. Unless I used a different file for each console/window
but that just gets me into the same situation I'm already in. I think
the only option is to set environment variables using another script.
I'm really surprised and disapponited by this.
Note that it's *not* a Python issue. You'd have the same problem with
any other language. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: David Stockwell |
last post by:
Hi,
In java/jsp I can pass parameters to my python script on a webpage by doing
something like this:
http://somewhere.org/mypage.jsp?parm1=something&parm2=another
How do I do that with python?
Also would I need to import a special module so I could grab them off the
|
by: Daves |
last post by:
I am saving to database a result from multi-line textbox. The database of
course wants \x escape codes, not the invisible ones. Is there any easy -
one line code - way to do this (c#) eg by String.Format() ?
|
by: Brad |
last post by:
I have code which takes an image, uploaded from a web page, and saves it to
a database. Now I want to always resize an uploaded image before it is
saved to the database. My code to resize is below and of course it's not
working properly because my web page which displays the resulting image from
the database is not showing the image. I...
|
by: NutsAboutVB |
last post by:
Hello,
I am a .NET programmer and I have a JPEG image file (from digital
camera) of about 109 KB's in size, when I open it and save it
(without making any alterations at all, just going to File --> Save) in
MS Photo Editor, the file is automatically shrunk in size to 81 KB's.
When doing the same thing in MS Paint, the file is shrunk to 54...
|
by: Xah Lee |
last post by:
In this article, i explain how the use of bit masks is a hack in many
imperative languages.
Often, a function will need to take many True/False parameters. For
example, suppose i have a function that can draw a rainbow, and each
color of the rainbow can be turned on or off individually. My function
specification can be of this form:...
| |
by: Wingot |
last post by:
Hey,
I am using Visual Studio 2008 Beta 2 for some application development in
C#, but I presume that the following question applies equally well to
any environment.
|
by: romcab |
last post by:
Hi guys,
I would like to ask your help about saving in ado.net. I was able to update it only on the display but when I check the database, it is not updated. I paste below my code and hopefully you can help me.
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
|
by: pozze |
last post by:
Hi,
I've just made the change from ASP to .net.
I have a file (code below) that saves a user submitted file to a MS SQL 2005 database. It collects the file name, file size, file type, and lastly the binary data for the file.
I can sucessfully take the files out of the databse again and display them in a data grid.
I would like to resize the...
|
by: Stef Mientki |
last post by:
Gabriel Genellina wrote:
Didn't work for me winXP-SP2, even after a restart :-(
But anyway thanks for the effort.
cheers,
Stef Mientki
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |