Re: os.system and subprocess odd behavior

2012-12-18 Thread py_genetic
Solved the issue, by injecting the query into the cmd line. Shell script worked fine as if I was cutting and pasting to the prompt. Seems to still be something with the subprocess receiving and exit code before or when the query finishes, just when I ask to to read from the .SQL file. example

Re: os.system and subprocess odd behavior

2012-12-18 Thread py_genetic
Oscar I can confirm this behavior from terminal. AND this works as well, simulating exactly what I'm doing permissions wise, and calling sudo python test.py below f1 = open('TESTDIR/file1.txt', 'w') f1.write('some test here\n') f1.close() cmd1 = 'cat < TESTDIR/file1.txt > TESTDIR/file2.txt' P

Re: os.system and subprocess odd behavior

2012-12-17 Thread py_genetic
Oscar, seems you may be correct. I need to run this program as a superuser. However, after some more tests with simple commands... I seem to be working correctly from any permission level in python Except for the output write command from the database to a file. Which runs fine if I past

Re: os.system and subprocess odd behavior

2012-12-17 Thread py_genetic
Thanks for verifying this for me Steven. I'm glad you are seeing it work. It's really the strangest thing. The issue seems to be with the " > outfile.txt" portion of the command. The actual command is running a query on a verticalDB and dumping the result. The EXACT command run from the comm

Re: os.system and subprocess odd behavior

2012-12-17 Thread py_genetic
Thanks! I am using .txt extensions. Sorry for being a little vague. -- http://mail.python.org/mailman/listinfo/python-list

os.system and subprocess odd behavior

2012-12-14 Thread py_genetic
Example of the issue for arguments sake: Platform Ubuntu server 12.04LTS, python 2.7 Say file1.txt has "hello world" in it. subprocess.Popen("cat < file1 > file2", shell = True) subprocess.call("cat < file1 > file2", shell = True) os.system("cat < file1 > file2") I'm finding that file2 IS crea

Re: Efficient way of generating original alphabetic strings like unix file "split"

2007-06-18 Thread py_genetic
On Jun 14, 3:02 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On Jun 14, 4:39 pm, py_genetic <[EMAIL PROTECTED]> wrote: > > > > You didn't try hard enough. :) > > > >http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/190465 > >

Re: Efficient way of generating original alphabetic strings like unix file "split"

2007-06-14 Thread py_genetic
> > You didn't try hard enough. :) > > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/190465 > > -- > HTH, > Rob Thanks Rob, "permutation" was the keyword I shcould have used! -- http://mail.python.org/mailman/listinfo/python-list

Efficient way of generating original alphabetic strings like unix file "split"

2007-06-14 Thread py_genetic
Hi, I'm looking to generate x alphabetic strings in a list size x. This is exactly the same output that the unix command "split" generates as default file name output when splitting large files. Example: produce x original, but not random strings from english alphabet, all lowercase. The lengt

Re: Create a new class on the fly

2007-06-01 Thread py_genetic
Alex, thanks for the advise: > > class PosRecords(tables.IsDescription): > > > class A(object): > > self.__init__(self, args): > > This makes 0 sense; maybe you should learn elementary Python syntax well > _before_ trying advanced stuff, no? I accidently left that erroneous snippet in, howeve

Create a new class on the fly

2007-05-30 Thread py_genetic
Is this possible or is there a better way. I need to create a new class during runtime to be used inside a function. The class definition and body are dependant on unknows vars at time of exec, thus my reasoning here. class PosRecords(tables.IsDescription): class A(object): self.__init__(s

Re: converting strings to most their efficient types '1' --> 1, 'A' ---> 'A', '1.2'---> 1.2

2007-05-21 Thread py_genetic
This is excellect advise, thank you gentelman. Paddy: We can't really, in this arena make assumtions about the data source. I fully agree with your point, but if we had the luxury of really knowing the source we wouldn't be having this conversation. Files we can deal with could be consumer data

converting strings to most their efficient types '1' --> 1, 'A' ---> 'A', '1.2'---> 1.2

2007-05-18 Thread py_genetic
Hello, I'm importing large text files of data using csv. I would like to add some more auto sensing abilities. I'm considing sampling the data file and doing some fuzzy logic scoring on the attributes (colls in a data base/ csv file, eg. height weight income etc.) to determine the most efficient

Re: pytables - best practices / mem leaks

2006-07-18 Thread py_genetic
py_genetic wrote: > I have an H5 file with one group (off the root) and two large main > tables and I'm attempting to aggragate my data into 50+ new groups (off > the root) with two tables per sub group. > > sys info: > PyTables version: 1.3.2 > HDF5 version:

Re: run a string as code?

2006-07-18 Thread py_genetic
Gary Herron wrote: > py_genetic wrote: > > py_genetic wrote: > > > >> [EMAIL PROTECTED] wrote: > >> > >>> py_genetic wrote: > >>> > >>>> How can you make python interpret a string (of py code) as code. For > >>>&g

Re: run a string as code?

2006-07-17 Thread py_genetic
py_genetic wrote: > [EMAIL PROTECTED] wrote: > > py_genetic wrote: > > > How can you make python interpret a string (of py code) as code. For > > > example if you want a py program to modify itself as it runs. I know > > > this is an advantage of interp

Re: run a string as code?

2006-07-17 Thread py_genetic
[EMAIL PROTECTED] wrote: > py_genetic wrote: > > How can you make python interpret a string (of py code) as code. For > > example if you want a py program to modify itself as it runs. I know > > this is an advantage of interpreted languages, how is this done in > >

run a string as code?

2006-07-17 Thread py_genetic
How can you make python interpret a string (of py code) as code. For example if you want a py program to modify itself as it runs. I know this is an advantage of interpreted languages, how is this done in python. Thanks. -- http://mail.python.org/mailman/listinfo/python-list

pytables - best practices / mem leaks

2006-07-17 Thread py_genetic
I have an H5 file with one group (off the root) and two large main tables and I'm attempting to aggragate my data into 50+ new groups (off the root) with two tables per sub group. sys info: PyTables version: 1.3.2 HDF5 version: 1.6.5 numarray version: 1.5.0 Zlib version: 1.2.3 BZIP2 ve

Re: segmentation fault in scipy?

2006-05-11 Thread py_genetic
>Now I'm even more confused. What kind of array is "error" here? First you tell >me it's a (25000, 80) array and now you are telling me it is a (25000,) array. >Once you've defined what "error" is, then please tell me what the quantity is >that you want to calculate. I think I told you several diff

Re: segmentation fault in scipy?

2006-05-11 Thread py_genetic
True! it is rediculous/insane as I mentioned and noted and agreed with you (in all your responses) and was my problem, however, not wrong (same result), as I was just simply noting (not to be right), although, yes, insane. Thanks again. -- http://mail.python.org/mailman/listinfo/python-list

Re: segmentation fault in scipy?

2006-05-11 Thread py_genetic
>No! matrix objects use matrix multiplication for *. You seem to need >elementwise >multiplication. No! when you mult a vector with itself transposed, the diagonal of the resulting matrix is the squares of each error (albeit you do a lot of extra calc), then sum the squares, ie trace(). Its a ni