Scikits.timeseries for 2.7

2011-07-21 Thread JB
I'm currently using python 2.7, with numpy and scipy already
installed, but I can't seem to install Scikits.timeseries. I've
downloaded the windows installer from sourceforge, but when I run it,
it checks for a 2.6 installation, and obviously doesn't find the 2.7
folder. Anyone know of a 2.7 installer?

Thanks
-- 
http://mail.python.org/mailman/listinfo/python-list


Use python to test Java and Windows (dll) applciations

2005-12-04 Thread jb
Hello everybody:

I need help, and please let me know if python is the language of choice
to implement following functionalities:

I am trying to test a Java application and a C++ (win32) application.

I want to be able to write python code to mimic user interaction with
the application.  Interaction could be mouse or keyboard
movement/events using which I want to be able to select Menus and
execute them. Please let me know if this is feasible using Python, if
yes, please refer me to a good resource.


Please help.
-jay

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Use python to test Java and Windows (dll) applciations

2005-12-05 Thread jb
Thanks Cameron, Watsup looks compelling to me and its going to keep me
busy for a while.  

Thanks for your help.

-jb

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to enable Python Scripts with MS IIS Web Server?

2005-02-04 Thread jb
hi,

you should first install win32all : 
http://starship.python.net/crew/mhammond/

next, 2 ways 2 proceed, but the first is the easier :

you make a "test.asp" page in the folder

at the top, you write <@Language=Python%>

a line below : <%Response.Write("Hello World")%>

try if the page works well. if it works then your python/iis install is 
ok

the second way is to keep the .py extension and to associate it with the 
python executable

http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B276494

hope this helps


juju



<[EMAIL PROTECTED]> a écrit dans le message de news: 
[EMAIL PROTECTED]
>
>
>
> Hi. I have MS Windows Server 2003, Enterprise Edition.
> It has MS Management Console 2.0, Version 5.2
> and IIS Manager 6.0
>
>
>
> I have a directory called "myDirs". Within this directory are 2 files:
> 1) index.pl (a perl script)
> 2) index.py (a python script whose first line is
> "#!C:\Python21\pythonw.exe")
>
> The webserver is listening on port 8080.
>
> When I point my browser to http://localhost:8080/myDirs/index.pl, it
> works... I see the output of the perl script.
>
> HOWEVER,
> When I point my browser to http://localhost:8080/myDirs/index.py, it
> simply shows the python file as text. It doesn't interpret it at all.
>
> How Can I get it to interpret the python file using the interpreter and
> display the output in the browser?
>
> Please explain each step in careful/excruciating detail because I'm a
> windows Newbie.
>
>
> -Saqib Ali
> 


-- 
http://mail.python.org/mailman/listinfo/python-list


popen2 usage

2005-07-19 Thread jb
Hi there:

I need help with popen2 usage.  I am coding on Windows 2000 environment
and I am basically trying to run command line executable program that
accepts command line arguments from user. I want to be able to provide
these arguments through input pipe so that executable does not require
any intervention from the user.  The way I am doing this is as below:

out1, in1 = popen2.popen2("testme.exe > abc.txt")
in1.write('-test1')
in1.flush()
in1.close()

But this does not seem to be working, when I open abc.txt file it does
not show '-test1' argument that was supplied via in1.write method. This
causing executable to wait forever unless user manually kills the
process.

Please help

Regards,
jb

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: popen2 usage

2005-07-21 Thread jb
Actually, "-test1" is a text argument that testme.exe should receive
from standard input. For example,
Executing testme.exe generates the following output,
Please select one of the following options:
1) test1
2) test2
3) exit
Please enter your option here:-test1 <-This -test1 is what user would
type

Thanks,
-JB


Steven Bethard wrote:
> jb wrote:
> > Hi there:
> >
> > I need help with popen2 usage.  I am coding on Windows 2000 environment
> > and I am basically trying to run command line executable program that
> > accepts command line arguments from user. I want to be able to provide
> > these arguments through input pipe so that executable does not require
> > any intervention from the user.  The way I am doing this is as below:
> >
> > out1, in1 = popen2.popen2("testme.exe > abc.txt")
> > in1.write('-test1')
> > in1.flush()
> > in1.close()
> >
> > But this does not seem to be working, when I open abc.txt file it does
> > not show '-test1' argument that was supplied via in1.write method. This
> > causing executable to wait forever unless user manually kills the
> > process.
>
> I'm confused; is "-test1" a command line argument to testme.exe?  Or is
> it the text that testme.exe should receive from standard input?
>
> Either way, I would suggest using subprocess instead of popen*.
>
> To pass -test1 as a command line argument, do something like:
>
> import subprocess as sp
> p = sp.Popen(["testme.exe", "-test1"], stdout=sp.PIPE)
> out1 = sp.stdout.read()
>
> To pass -test1 through standard input, do something like:
>
> import subprocess as sp
> p = sp.Popen(["testme.exe"], stdout=sp.PIPE)
> p.stdin.write("-test1")
> p.stdin.flush()
> p.stdin.close()
> out1 = p.stdout
> 
> HTH,
> 
> STeVe

-- 
http://mail.python.org/mailman/listinfo/python-list


Guido at Google

2005-12-21 Thread JB
It seems that our master Guido van Rossum had an offer from google and 
he accepted it!!

long life to Guido & Goole ! many things to come ;)

ju²
-- 
http://mail.python.org/mailman/listinfo/python-list


How to check if the connectivity is via Ethernet or dial-up

2006-07-08 Thread jb
Hi all:

I was just wondering if there is a way to check (using python
scripting) whether the computer's connectivity is via Dial-up or
LAN/Ethernet adaptor? Is there a way in python to check the status of
all available Ethernet adaptors?  If not is there a way to achieve this
by  just checking some network parameters using System module?.

Please help.

Thanks,
-JS

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Reading from text

2009-02-17 Thread JB

oamram a écrit :

Hi All,
new to python. i have a directory with about 50 text file and i need to
iterate through them and get
line 7 to 11 from each file and write those lines into another file(one file
that will contain all lines).


First create a function that read and parse one file

Then create a loop that call this function for each file in a directory

Modules to read :

http://www.python.org/doc/2.5.2/tut/node9.html#SECTION00921
http://docs.python.org/library/os.html


Julien
--
http://mail.python.org/mailman/listinfo/python-list


Re: pdftk

2009-02-24 Thread JB

Reimar Bauer a écrit :

Hi

Does one know about a python interface to pdftk?
Or something similar which can be used to fill a form by fdf data.


everyday i use :

import os
os.system("pdftk.exe source.pdf fill_form data.fdf output output.pdf 
flatten")


and BIM


;)
--
http://mail.python.org/mailman/listinfo/python-list


Executing multiple subprocesses and waiting

2011-01-26 Thread JB
One of my python scripts that takes a bunch of inputs from a tKinter
gui, generates a set of command line stings, and then threads them off
to subprocess for calls to other programs like Nuke and our render
farm has recently started randomly crashing pythonw.exe.

I'm taking a look at my threading setup and attempting to clean it up.
I was wondering what a smart way of doing what I describe is? Take a
list of strings containing command line calls to other programs,
process them one at a time (waiting for the previous one to complete
before starting the next) and then finishing elegantly. Currently, the
gui passes them all to a "workerThread" which loops through each
string, sending it to a "processThread" which makes a call to
subprocess to execute it.

This has worked fine for over a year so the recent crashing is
mystifying me. I'm wondering if it's increased network stress (we've
grown) or something similar?

Any thoughts and suggestions on waiting for threads to complete are
appreciated.
-- 
http://mail.python.org/mailman/listinfo/python-list


Encoding troubles

2010-05-17 Thread JB
I'm working on the webapp of our company intranet and I had a question
about proper handling of user input that's causing encoding issues.

Some of the uesrs take notes in Microsoft Office and copy/paste these
into textarea's of the webapp. Some of the characters from Word such
as hypens (–) and apostrophes (’) are in an odd encoding. When passed
to the database using sqlalchemy they appear as – and other
characters.

What's the proper handling (conversion?) of user input before it gets
to my database. Do I need to start making a list of the offending
characters and .replace them? Or is there a means to decode/encode the
user input to something more generic? Thanks for your time.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python/Fortran interoperability

2009-08-23 Thread JB
["Followup-To:" header set to comp.lang.fortran.]
On 2009-08-23, n...@cam.ac.uk  wrote:
>
> I am interested in surveying people who want to interoperate between
> Fortran and Python to find out what they would like to be able to do
> more conveniently, especially with regard to types not supported for C
> interoperability by the current Fortran standard.  Any suggestions as to
> other ways that I could survey such people (Usenet is no longer as
> ubiquitous as it used to be) would be welcomed.
>
> My Email address is real, so direct messages will be received.
>
> Specifically, I should like to know the answers to the following
> questions:
>
> 1) Do you want to use character strings of arbitrary length?

As in, a signed C int (that most Fortran implementations use to keep
track of string lengths) may not be sufficient? No, I'm not
particularly interested in that.

> 2) Do you want to use Python classes with list members, where the
> length of the list is not necessarily fixed for all instances of the
> class?  Or, equivalently, Fortran derived types containing allocatable
> or pointer arrays?

Yes.

> 2) Do you want to use Fortran derived types or Python classes that
> contain type-bound procedures (including finalizers)?  Please answer
> "yes" whether or nor you would like to call those type-bound procedures
> from the other language.

In python I use it all the time, haven't used any F2003 OOP features
yet.  

> 4) Do you want to call functions where the called language allocates
> or deallocates arrays/lists/strings for use by the calling language?
> Note that this is specifically Fortran->Python and Python->Fortran.

Yes. 


Generally speaking, f2py today is not that bad, though it's getting
long in the tooth. There is a project called fwrap that aims to create
an improved python/Fortran bridge:

http://conference.scipy.org/static/wiki/smith_fwrap.pdf

This project uses ISO_C_BINDING, and I think that this is the correct
approach rather than trying to keep up with whatever ABI's all those
Fortran compilers use. So from the Fortran side of the fence, I
suppose the path forward would be to improve on the C binding
functionality (this would also of course benefit other language
bindings than just python). Whether TR 29113 is the right path forward
or not I have no strong opinion on. Specifically what's needed is some
way to portably access the array descriptor data, and maybe also how
to access the OOP functionality in a standardized way. The experience
with C++ ABI's suggests that this might not be as straightforward as
it sounds.


-- 
JB
-- 
http://mail.python.org/mailman/listinfo/python-list


Iterating Through Dictionary of Lists

2009-09-11 Thread JB
I have created a small program that generates a project tree from a
dictionary. The dictionary is of key/value pairs where each key is a
directory, and each value is a list. The list have unique values
corresponding to the key, which is a directory where each value in the
list becomes a subdirectory.

The question that I have is how to do this process if one of the
unique values in the list is itself a dict. For example, in the
"projdir" dict below, suppose the "Analysis" value in the list
corresponding to the "Engineering" key was itself a dict and was
assigned {'Analysis' : 'Simulink'} for example.

Thanks.
James


#-
# DEFINE Root Dir & Path, Sch Numbers
#-
sch_names = ['AED500','AED600']
dir_main  = "Z:\\ABC_PROJ\\"
dir_sub   = "PCB_MDX\\"
rootdir   = dir_main + dir_sub
#-
# DEFINE Directory Tree for Project
#-
projdir =  {'Project':  ['Schedule', 'Specifications',
'Procedures'],
'Schematics_PCB' :  ['SCH','BOM','ASSY'],
'Drawings'   :  ['System', 'Board', 'Packaging_3D'],
'Engineering':  ['Analysis', 'Reports', 'Design Reviews']}
#-
# DEFINE Debug Status
#-
debug = True
#-
# Print Directory Path (Helper Func)
#-
def print_path(z,suffix):
print z
print z + suffix
#-
# Make a Directory Project Tree
#-
def make_tree_with_debug(proj,sch,root):
counter = 0
print "The dictionary was found to have the following: \n"

#-
# Iterate over items in the dictionary, creating tuples of key/value
pairs

#-
for key, values in proj.iteritems():
counter = counter + 1
print "Key #" + str(counter) + " is "  + "'" + key + "\'"
print "For this key, the values are " + str(values)
print "Thus, the results of generating directories for this key/
values combo are: \n"
#-
# Iterate over the invidividual unique values in the list
# that is associated with each key in the dict
#-
for unique in values:
prefix = root + key +  "\\" + unique
suffix = "\\Previous \n"
if key == 'Schematics_PCB':
print unique
for item in sch:
z = prefix + "\\" + item
print_path(z,suffix)
else:
#if unique.haskeys():
#   print unique.key
z = prefix
print_path(z,suffix)


make_tree_with_debug(projdir,sch_names,rootdir)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Iterating Through Dictionary of Lists

2009-09-14 Thread JB
On Sep 11, 9:42 am, Stefan Behnel  wrote:
> JBwrote:
> > I have created a small program that generates a project tree from a
> > dictionary. The dictionary is of key/value pairs where each key is a
> > directory, and each value is a list. The list have unique values
> > corresponding to the key, which is a directory where each value in the
> > list becomes a subdirectory.
>
> > The question that I have is how to do this process if one of the
> > unique values in the list is itself a dict. For example, in the
> > "projdir" dict below, suppose the "Analysis" value in the list
> > corresponding to the "Engineering" key was itself a dict and was
> > assigned {'Analysis' : 'Simulink'} for example.
>
> You might want to read up on recursion, i.e. a function calling itself.
>
> You can find out if something is a dict like this:
>
>         isinstance(x, dict)
>
> or, if you know it really is a dict and not a subtype:
>
>         type(x) is dict
>
> Stefan

Stefan;

Thanks for your valuable suggestion. I have employed your suggestion
with the code below.
I also converted this to object oriented design. With this type of
construction, the
program will easily handle the dictionary specified by the self.proj
variable. This
variable is a dictionary with some of the value variables also being
dictionaries.
I did not generalize the function call but have more of horizontal
code for this
area of the implementation. If this program were packaged with a GUI,
it would
make the beginning of a project management software platform.

-James



from time import strftime
import os

#-
# Print/Make Directories
#-
class Tree:
 def __init__(self,dir_main,dir_sub,sch_names,drawing_name):
self.proj = {'Project':  ['Schedule',
'Specifications'],

'Schematics_PCB' :  [{'SCH':sch_names},{'BOM':sch_names},
{'ASSY':sch_names},
 {'RELEASE':sch_names}],

'Drawings'   :  [{'System':drawing_name},
{'Board':sch_names},
 'Packaging_3D'],

'Engineering':  [{'Analysis':
['Simulink','Matlab','Excel',
  'MathCad','Python']},
 {'Eng Reports':sch_names}, {'Design
Reviews':sch_names},
 {'Procedures':['Board Test','System
Test']}]}
self.sch_names= sch_names
self.drawing_name = drawing_name
self.dir_main = dir_main
self.dir_sub  = dir_sub
self.root = self.dir_main + self.dir_sub
self.pathname = ''
self.suffix   = "\\Previous \n"
self.recursion= 0.0
self.zs   = ''

 def gen_dir(self):
if os.path.exists(self.pathname):
pass
else:
os.makedirs(self.pathname)
return

 def print_path(self):
print self.pathname
Tree.gen_dir(self)

self.zs = self.pathname + self.suffix

Tree.gen_dir(self)
print self.zs
#-
# Make a Directory Project Tree
#-
 def make_tree(self):
counter = 0
print "This project tree for " + self.dir_sub[0:-1] + " was completed
by "
print "Generated on " + strftime("%m/%d/%Y at %H.%M hours")
print "The project tree / dictionary was found to have the following:
\n"

#-
# Iterate over items in the dictionary, creating tuples of key/value
pairs

#-
for key, values in self.proj.iteritems():
counter = counter + 1
print "Key #" + str(counter) + " is "  + "'" + key + "\\"
print "For this key, the values are " + str(values)
print "Thus, the results of generating directories for this "
print " key/values combo are: \n"
#-
# Iterate over the invidividual unique values in the list
# that is associated with each key in the dict, where
# an individual value may itself be a dict
#-
for unique in values:
prefix = self.root + key +  "/"
if isinstance(unique, dict) == True:
for kx,vx in unique.iteritems():
if isinstance(vx,list) == True:
for items in vx:
  self.pathname = prefix  + kx 
+  "\\" + items
  Tree.print_path(self)
  

Re: Any reliable obfurscator for Python 2.5

2008-04-20 Thread JB Stern
Banibrata Dutta wrote:
>>Wanted to check if there is any known, reliable, FOSS/Libre -- Obfurscator
>> for Python 2.5 code.

No, sadly, there is not.  There are a number of applications I would be
working on if it were possible to obfuscate pyc files.  About the best
you can do as of 2008/04 is use Jython to compile into Java bytecode and
obfuscate that using Proguard.

Steve 'not an economics major' Holden wrote:
>The Python world isn't particularly paranoid about obfuscation. It's 
>quite easy to publish compiled code only (.pyc and/or .pyo files), and 
>that offers enough protection for most.

Curious Steve, how do you pay the rent and by what authority do you
speak for "The Python world"?  Your opinion couldn't be more wrong for
programmers like myself who live by the code they write (as opposed to
its support).

Steve 'not a software consultant' Holden wrote:
>The sad fact is that there seems to be an almost direct inverse 
>correlation between the worth of the code and the authors' desire to 
>protect it from piracy.

Would love to see some evidence to that effect.  

JB
-- 
http://mail.python.org/mailman/listinfo/python-list