Re: lipo: can't figure out the architecture type of

2009-03-23 Thread VJ
On Mar 19, 4:48 pm, Vijayendra Bapte vijayendra.ba...@gmail.com
wrote:
 Hi,

 I am getting an gcc compilation error while installing FSEvents
 (http://pypi.python.org/packages/source/p/pyobjc-framework-FSEvents/
 pyobjc-framework-FSEvents-2.2b1.tar.gz) package on my Mac (OS X
 10.4.11, Intel Core Duo 32 bit processor, Python2.6.1, gcc: i686-apple-
 darwin8-gcc-4.0.1)

 gcc failed while building the FSEvents._callbacks extension on $
 python setup.py install

 here is the error trace...

 running install_lib
 running build_py
 running build_ext
 building 'FSEvents._callbacks' extension
 gcc -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -
 fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -O3 -I/Library/
 Frameworks/Python.framework/Versions/2.6/include/python2.6 -c Modules/
 _callbacks.m -o build/temp.macosx-10.3-i386-2.6/Modules/_callbacks.o -
 O0
 Modules/_callbacks.m:60: error: parse error before
 'm_python_context_template'
 Modules/_callbacks.m:62: warning: excess elements in scalar
 initializer
 Modules/_callbacks.m:62: warning: (near initialization for
 'm_python_context_template')
 Modules/_callbacks.m:63: warning: excess elements in scalar
 initializer
 .
 .
 .
 .
 (Error ending with)
 Modules/_callbacks.m:133: error: previous definition of 'result' was
 here
 Modules/_callbacks.m:353: error: parse error before 'FSEventStreamRef'
 lipo: can't figure out the architecture type of: /var/tmp//
 cco6kalc.out
 error: command 'gcc' failed with exit status 1

 Could someone help me in solving this compilation error?

Finally after doing lots of search on google, I found that there is no
support of FSEvents for Tiger. It wraps some API's that aren't
available on Tiger systems.

Alternatives:

(1) Using kqueue/kevent: It might be possible to emulate the behavior
using kevent/kqueue. But the problem here is, it does not provide the
granularity as FSEvents i.e I you cannot detect which file is modified/
added/deleted inside the marked directory.

(2) The other alternative is polling for changes.
--
http://mail.python.org/mailman/listinfo/python-list


Help needed with translating perl to python

2007-06-26 Thread vj
I have a perl script which connect to network stream using sockets.
The scripts first logins in to the server and then parses the data
comming from the socket.

Statement 1:
  my $today = sprintf(%4s%02s%02s, [localtime()]-[5]+1900,
[localtime()]-[4]+1, [localtime()]-[3]) ;


Statement 2:
  my $password = md5_hex($today$username) ;

Statement group 3:

$msglen = bcdlen(length($msg)) ;

sub bcdlen {
  my $strlen = sprintf(%04s, shift) ;
  my $firstval = substr($strlen, 2, 1)*16 + substr($strlen, 3, 1) ;
  my $lastval  = substr($strlen, 0, 1)*16 + substr($strlen, 1, 1) ;
  return chr($firstval) . chr($lastval) ;
}

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


Re: Help needed with translating perl to python

2007-06-26 Thread vj
I posted too soon:

 Statement 1:
   my $today = sprintf(%4s%02s%02s, [localtime()]-[5]+1900,
 [localtime()]-[4]+1, [localtime()]-[3]) ;

1. is localtime the same as time in python?
2. What does - ? do in perl?
3. What is 'my'

 Statement 2:
   my $password = md5_hex($today$username) ;

is md5_hex the same as md5.new(key).hexdigest() in python?

 $msglen = bcdlen(length($msg)) ;

1. here the funciton is being called with the length of variable msg.
However the function def below does not have any args

 sub bcdlen {
   my $strlen = sprintf(%04s, shift) ;
   my $firstval = substr($strlen, 2, 1)*16 + substr($strlen, 3, 1) ;
   my $lastval  = substr($strlen, 0, 1)*16 + substr($strlen, 1, 1) ;
   return chr($firstval) . chr($lastval) ;

 }

2. What does shift do above?
3. is the '.' operator just + in python?

Thanks,

Vineet



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


Re: Questions on migrating from Numeric/Scipy to Numpy

2007-03-14 Thread vj
What should I be using to replace Numeric/arrayobject.h:

numpy/arrayobject.h

or

numpy/oldnumeric.h

Thanks,

VJ

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


Questions on migrating from Numeric/Scipy to Numpy

2007-03-13 Thread vj
I've tried to post this to the numpy google group but it seems to be
down. My migration seems to be going well. I currently have one issue
with using scipy_base.insert.

 a = zeros(5)
 mask = zeros(5)
 mask[1] = 1
 c = zeros(1)
 c[0] = 100
 numpy.insert(a, mask, c)
array([ 100.,0.,  100.,  100.,  100.,0.,0.,0.,
0.,0.])
 a
array([ 0.,  0.,  0.,  0.,  0.])
 b
array([0, 0, 0, 0, 0, 0, 0, 0, 0, 1], dtype=int8)
 mask
array([ 0.,  1.,  0.,  0.,  0.])
 c
array([ 100.])

I would have expected numpy.insert to update a so that the second
element in a would be 100.

Thanks,

VJ

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


Re: Questions on migrating from Numeric/Scipy to Numpy

2007-03-13 Thread vj
 It is just a redirection to the [EMAIL PROTECTED] list. If you just
 tried in the past hour or so, I've discovered that our DNS appears to be down
 right now.

I tried registering the twice the last couple of days and never got an
email back.

 No, that's not what insert() does. See the docstring:

Then this behavior is different from the scipy_base.insert

 In [7]: a[mask] = 100

What I needed was

a[mask] = array_of_values

I just tried it and  it works.

Thanks,

VJ

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


Re: Questions on migrating from Numeric/Scipy to Numpy

2007-03-13 Thread vj
 Note that the mask needs to be a bool array.

 mask = zeros(5)
 mask = zeros(5, numpy.int8)
 mask[1] = True
 mask[2] = True
 a = zeros(5)
 a[mask] = [100, 200]
 a
array([ 100.,  100.,0.,0.,0.])

I found this strange. It should just give an error if you try to use a
mask array of non booleans. It's working great so far.

Thanks for all the hard work.

VJ

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


Re: ANN: IbPy 0.7.0-9.00 - Interactive Brokers Python API

2007-02-23 Thread vj
Cool. Why is python 2.5 required, will it not work with python 2.4?

VJ

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


Does anyone have the db_row module compiled for python 2.4 on windows?

2007-02-12 Thread vj
Would really appreciate the binary files for the db_row.

Thanks,

VJ

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


I'm looking to learn pyqt

2006-12-06 Thread vj
Is there a a tutorial or a sample application I can start with (that
works with qt4 and pyqt4)?

Thanks,

VJ

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


Re: os.mkdir and mode

2006-12-02 Thread vj
 To fix your problem, reset your umask thus :-

Thanks for the detailed reply. Your fix works like a charm. 

VJ

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


os.mkdir and mode

2006-12-01 Thread vj
How do I do the following unix command:

mkdir -m770 test

with the os.mkdir command. Using os.mkdir(mode=0770) ends with the
incorrect permissions. 

Thanks,

VJ

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


Anynoe have any examples on how to use python with paypal?

2006-11-17 Thread vj
I looked all over the web and can't seem to find any examples. Surely
someone must be using python to access the paypal SDK. I found this
link for ruby  (which was helpful), but python code would be better:

http://www.jeremyhubert.com/2006/7/7/using-paypal-website-payments-pro-with-ruby-on-rails

Any examples would be greatly appreciated. 

VJ

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


Has anyone generated Open Office Calc XML files from python

2006-11-16 Thread vj
I have a program which generates xml files for excel but these files
are not recognized by open office calc. I looked at the OO uno library,
but it seems like an over kill.

In my experience, for simpler documents, it is much faster to directly
write to underlying XML format. Has anyone done this? Any idea on the
XML format used by Open Office Calc?

VJ

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


Re: Has anyone generated Open Office Calc XML files from python

2006-11-16 Thread vj
I just found something in perl:

http://tools.openoffice.org/profiling/pod/LogFile/XML.html

Will try and reverse engineer this, unless something like this exists
in python. 

VJ

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


Re: Has anyone generated Open Office Calc XML files from python

2006-11-16 Thread vj

  http://ooopy.sourceforge.net/

I downloaded the package. unfortunately there are no examples that come
with. I found another python package which is more geared to creating
simple calc objects from python at. Apparently it is a port of the perl
library.

http://sourceforge.net/project/showfiles.php?group_id=87437

Here is one of the examples from the library. Seems pretty simple and
exactly what I was looking for:

---
import ooolib

# Create your document
doc = ooolib.Calc()

# Set values.  The values are set in column, row order, but the values
are
# not in the traditional A5 style format.  Instead we require two
integers.
# set_cell_value(col, row, datatype, value)
for row in range(1, 9):
for col in range(1, 9):
doc.set_cell_value(col, row, float, col * row)

# Save the document to the file you want to create
doc.save(calc-example01.ods)

---
VJ

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


Re: Has anyone generated Open Office Calc XML files from python

2006-11-16 Thread vj
 Isn't generating CSV output suitable to your needs?
 Python's CSV module makes that very simple - unless you want to include
 images, etc. in the XLS file?

You cannot create multiple worksheets using this method, or apply any
other form of formatting. 

VJ

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


Re: ANN: PyQt v4.1 Released

2006-11-05 Thread vj
 Riverbank Computing is pleased to announce the release of PyQt v4.1
 available from http://www.riverbankcomputing.co.uk/pyqt/.

What's the best way to learn pyqt. Do the examples from the book GUI
Programming with Python: QT Edition still work? Is the material from
the book mostly valid or have things changed quite a bit?

http://www.commandprompt.com/community/pyqt/

Vineet

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


Re: wing ide vs. komodo?

2006-11-04 Thread vj
I've tried both and find WingIDE much faster than Komodo and the layout
is very well thought out. I love the way you can collapse all the
differnet panes with a few keystrokes. I also like their autocomplete
functionality.

Wing is developed by a small company, focussed on python development,
while komodo supports all the major scripting languages. 

VJ

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


Re: wing ide vs. komodo?

2006-11-04 Thread vj
Forgot to mention WING's file search and replace is pretty cool and
powerful. It keeps checking changes in a different thread. If you want
to change yyy in say 100 files you would:

1. specify yyy in the search window
2. A list of files get displayed with matching yyy
3. As you fix replace yyy in the files the list of files with matching
yyy reduces automatically. This is very cool and very useful.

Another thing I like about WING is that it warns you if you have tabs
ans spaces mixed in a file.

The embedded python shell is also a useful feature.

VJ

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


Re: recommended general-purpose string template packages?

2006-08-15 Thread vj
I use preppy from reportlab:

http://www.reportlab.org/preppy.html

It's one file, is fast and can be easily embedded in any application.

Vineet

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


Re: PyLint 0.11 / astng 0.16

2006-04-21 Thread vj
It does. In my case I'm thinking of embedding pylint to check user
scripts which are written in python.

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


Re: PyLint 0.11 / astng 0.16

2006-04-20 Thread vj
Are there any plans to release pylint under the LGPL license?

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


Need help with python one liners which will not be caught by signal.alarm

2006-04-19 Thread vj
I'm trying to create a semi restricted env where users are not able to
bring my application down. I know the following:

1**1000

will not be caught by signal.alarm since it is executed in c code. Are
there other examples?
Will [100]*100 be cought by signal.alarm?

Thanks,

VJ

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


Re: Pyrex installation on windows XP: step-by-step guide

2006-04-19 Thread vj
Can you use the stock python build or do you have to build python from
scratch with mingw to use pyrex modules built with mingw?

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


how to use ez_setup on a machine which does not have access to the internet

2006-03-28 Thread vj
I did the following:

1. Downloaded ez_setup.py
2. Downloaded the setuptools-0.6a10-py2.4.egg
3. Downloaded the pysqlite-2.0.6-py2.4-linux-i686(2).egg

Transferred all the files to the computer which is behind a firewall
(with no access to the internet).

I then did the following:

path_to_python ez_setup.py setuptools-0.6a10-py2.4.egg

it failed even though the setuptools-0.6a10-py2.4.egg was in the same
directory. It gives me an error:

urllib2.URLError: urlopen error (-2, 'Name or service not known')

I looked at the documentation and it talked about a -f flag which
allows you to specify the directory to look for the files and that did
not work either.

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


What's the best way to learn perl for a python programmer?

2006-03-24 Thread vj
I've been given a project which requires writing scripts that need to
be run on over 3000 servers. Only about 15% of them have python
installed on them. While all/most of them will have perl.

I'll try and do as much as possible in pexpect but am sure I'll have do
some significant perl. Any suggestions on what is the best way to get
upto speed on perl?

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


How to find out the next Friday using RelativeDateTime

2006-03-23 Thread vj
I'm doing:

a = now()
delta = ReltaiveDateTime(days=+6, weekday(mx.DateTime.Friday, 0))
Next Friday: a+delta

a: march 23
a+delta: Gives me March 31st and not March 24th

Any ideas?

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


Re: How to find out the next Friday using RelativeDateTime

2006-03-23 Thread vj
I figured out how to do it. This does not work:

delta = ReltaiveDateTime(days=0, weekday(mx.DateTime.Friday, 0))

But this works:

delta = ReltaiveDateTime(days=+0, weekday(mx.DateTime.Friday, 0))

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


Re: How to find out the next Friday using RelativeDateTime

2006-03-23 Thread vj
Thanks for pointing out that the days=+0 is not necessary. Your other
points are well noted.

Thanks

VJ

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


Need help with restricting number of new objects a user script can create

2006-03-22 Thread vj
I'm building a large infrastructure with about 30 servers (all running
linux). I allow my end users to write scripts which then get broken
down in smaller parts and run across the 30 servers. The results from
each individual run are combined and presented back to the user.

I'm currently using pylint to restrict access to many things and make
the code a little more 'safe'. (I understand that it is very
difficult, if not impossible, to make the code completely secure).
The problem I'm facing now is:

how do I restrict the user from (inadvertently or maliciously) creating
a large number of objects which will bring down the entire 100 nodes.

Some of the things which I have ruled out (due to application
architecture):
1. Running each process in its own unix process.

Current Options:
1. expose my own version of range and xrange
2. Have a sandbox where the user script is run on random data before
being pushed out to the all the servers.

Questions:
1. How can I restrict recursion for the user scripts?
2. How can I restrict list comprehension in the user script? How do I
disable user from doing [1]*10
4. Can I move the user scripting to some other language which can be
interfaced with python yet allow the restricted execution env.
4. Can I convert the user functions using some 'modified' variant of
pyrex which will give me more control?

Have other people faced similar problems? I would imagine this is a
common problem for anyone building distributed systems?

Python 3000:
Going forward this would be a really useful thing to see in python 3000
where a restricted exec env should be built in to the language from the
ground up.

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


File Permissions

2006-03-10 Thread VJ
Hi All

I need to get the user permission of a file using python. I was trying
the following code which i found on google grups

 st = os.stat(myfile)
mode = st[stat.ST_MODE]
if mode  stat.ST_IREAD:
print readable
if mode  stat.ST_IWRITE:
print writable
if mode  stat.ST_IEXEC:
print executable

I am getting a error saying

 Traceback (most recent call last):
  File ./test.py, line 23, in ?
if mode  stat.ST_IREAD:
AttributeError: 'module' object has no attribute 'ST_IREAD' 

any idea how to resolve this error ??

Basically i want to write into a file .If the permissions are not there
then print a error message.
How do i achive this ???

Thanks,
VJ

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


I am not able to setup pydb2 ! Any help !

2005-09-21 Thread vj
When I run the setup.py script , it throws an error

Traceback (most recent call last):
  File C:\vijay\db2\utils\PyDB2-1.1.0-2.tar\PyDB2-1.1.0\setup.py,
line 57, in -toplevel-
libraries=[ db2lib ],
  File C:\Python24\lib\distutils\core.py, line 137, in setup
raise SystemExit, gen_usage(dist.script_name) + \nerror: %s % msg
SystemExit: usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2
[cmd2_opts] ...]
   or: setup.py --help [cmd1 cmd2 ...]
   or: setup.py --help-commands
   or: setup.py cmd --help

error: no commands supplied


Please let me know , what should have been the issue.

Thanks in advance.

Vj

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


Re: I am not able to setup pydb2 ! Any help !

2005-09-21 Thread vj
I am new to Python . Please let me where should I issue the command
setup.py install.

I have been using the IDLE to run Python scripts.

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


Re: I am not able to setup pydb2 ! Any help !

2005-09-21 Thread vj
Unfortunately I get another error

Your DB2 root is: C:\Program Files\IBM\SQLLIB\
running install
running build
running build_py
creating build
creating build\lib.win32-2.4
copying DB2.py - build\lib.win32-2.4
running build_ext
error: The .NET Framework SDK needs to be installed before building
extensions f
or Python.

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