Re: SystemError when defining

2011-11-05 Thread Terry Reedy

On 11/4/2011 9:53 PM, Joshua Landau wrote:

Joshua found bugs.python.org and, 2 hours
later, a fix was applied.
http://bugs.python.org/__issue13343 


It was impressively fast. Those python devs are like a hawk.
Although I wasn't expecting a three-line patch (plus a three line test).


We are not always so fast, but the public perception of our speed is 
skewed by a) the occasional bug that sits on the tracker for years and 
b) the near invisibility of bugs caught and quickly fixed by a developer 
without posting an issue on the tracker.


In this case, you made a very good report with a minimal reproducible 
buggy code snippet, plus a report of similar snippets that worked. Then 
it was quickly seen by someone familiar with the relevant file.


--
Terry Jan Reedy

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


Re: Can I fully replace GNU Bash with Python?

2011-11-05 Thread Devin Jeanpierre
> Is there a way I can replace the ~/develop/1-build/swift.sh script
> with a ~/develop/1-build/swift.py script, yet still retain the ability
> to work on one major function WITHOUT requiring the other major
> functions and the 1-build directory to be present?

I thought I followed along, but I don't see where the problem is here.
Did you try something and it didn't work, or are you asking if in
principle it can work?

In principle, it can work fine. the mainfunction modules can be
importable modules with some functions, or they can be (like they are
in sh) runnable scripts called by your build script, or whatever. You
can diverge as much as you want from how sh works, or stay as close as
you want, down to the level of only interoperating with other python
modules by invoking them as programs.

Devin

On Sat, Nov 5, 2011 at 1:27 AM, Jason Hsu, Mr. Swift Linux
 wrote:
> This question concerns my process of creating Swift Linux from the
> base distro (antiX Linux in the past, Linux Mint Debian Edition now).
> (NOTE: The process I'm describing here is an oversimplification.)
>
> All of my development work takes place in the ~/develop directory.
> This is the directory where I enter the "git clone" command to
> download the repositories from GitHub.  These repositories are 1-
> build, majorfunction1, majorfunction2, and so on.  After I download
> these repositories, I have the directories ~/develop/1-build, ~/
> develop/majorfunction1, ~/develop/majorfunction2, and so on.
>
> The ~/develop/1-build directory contains the scripts that build Swift
> Linux.  Each major function needed to create Swift Linux (such as
> changing web browser configuration files, changing login manager
> configuration files, etc.) has its own majorfunction# repository.
>
> For developing the latest version of Swift Linux, I had the swift.sh
> script in the  ~/develop/1-build directory call scripts in the
> majorfunction directories with commands like:
> sh ~/develop/majorfunction1/main.sh
> sh ~/develop/majorfunction2/main.sh
> and so on
>
> Please note that one can run any of these major functions
> independently OR as part of the ~/develop/1-build/swift.sh script.
> The ability to run any major function independently means I can focus
> on just one function that's not working as it should WITHOUT messing
> around with other functions.  This ability will be especially
> important when I have an actual team working on Swift Linux.
>
> What I'd like to do is replace GNU Bash with Python.  I know I can
> replace the main.sh scripts with main.py scripts.  Then the commands
> in the swift.sh script would be:
> python ~/develop/majorfunction1/main.py
> python ~/develop/majorfunction2/main.py
> and so on
>
> Is there a way I can replace the ~/develop/1-build/swift.sh script
> with a ~/develop/1-build/swift.py script, yet still retain the ability
> to work on one major function WITHOUT requiring the other major
> functions and the 1-build directory to be present?
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list


xml-rpc server on wine

2011-11-05 Thread pacopyc
Hi, I have a XML-RPC server python running on VM Windows (on Linux)
and a XML-RPC client python on Linux. Server and client have different
IP address. I'd like migrate server on wine. How can communicate
server and client? IP address is different or is the same?
Can you help me?

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


Re: inserting \ in regular expressions [solved]

2011-11-05 Thread Ross Boylan
On Wed, 2011-10-26 at 12:48 -0700, Ross Boylan wrote:
> I want to replace every \ and " (the two characters for backslash and
> double quotes) with a \ and the same character, i.e.,
> \ -> \\
> " -> \"
I'd like to thank Ian, Dave, MRAB, and John for their helpful responses.
I hadn't realized the interpreter was giving me the repr, and that
differed from the str.

I've since found one other solution: email.utils.quote() does exactly
the substitution I was looking for--not surprising, since I was doing it
for email.

Here's my little test program:
#! /usr/bin/python
import email, email.utils, re
s0 = r'I am " a silly \quote'
print s0
print re.sub(r'(\\|")', r'\\\1', s0)
print email.utils.quote(s0)

Output
I am " a silly \quote
I am \" a silly \\quote
I am \" a silly \\quote

Ross


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


httpd.conf configuration for mod_wsgi.so on wamp (apache)?

2011-11-05 Thread wojciech777
Hi there.

Is there any way to run python web application (or simple web page in
web.py) on Windows with wamp without starting built-in wsgi server
manually (python run.py).

I know there's a documentation on http://webpy.org/install#apachemodwsgi,
but it doesn't show where exactly in httpd.conf I should place the
commands.

In my example I would like to get start page, simply by typing in my
browser e.g. http://localhost:8070, and my file is located in: c:/
wamp/
www/xaura/run.py

source of run.py:
#!/usr/bin/env python
import web
urls = ('/', 'hello',
'', 'hello')
class hello:
def GET(self):
return "Hello, world."
app = web.application(urls, globals())
if __name__ == "__main__": app.run()

Any help will be appreciated.
Thanks
Wojciech Kaźmierczak
-- 
http://mail.python.org/mailman/listinfo/python-list


Python ORMs Supporting POPOs and Substituting Layers in Django

2011-11-05 Thread Travis Parks
Hello:

A new guy showed up at work a few weeks ago and has started talking
about replacing a 6 month old project, written in ASP.NET MVC, with an
open source solution that can handle massive scaling. I think his
primary concern is the "potential" need for massive web farms in the
future. In order to prevent high licensing costs, I think he wants to
move everything to open source technologies, such as the LAMP stack. I
also don't think he truly understands what ASP.NET MVC is and thinks
it is the older WebForms.

I have been researching open source MVC frameworks and came across
Django. It looks like an awesome tool, but I am willing to look at
others. I have experience in Python (and enough in PHP to want to
avoid it and absolutely none in Ruby) so I think it would be a good
language to develop in.

I was wondering if there were any ORMs for Python that used POPOs
(plain old Python objects). There is a lot of business logic in my
system, and so I want to keep my data objects simple and stupid. I
want the ORM to be responsible for detecting changes to objects after
I send them back to the data layer (rather than during business layer
execution). Additionally, being a stateless environment, tracking
objects' states isn't very useful anyway.

Honestly, I doubt this guy is going to get his wish. The people paying
for the application aren't going to be willing to throw 6 months of
work down the drain. Never the less, I want to have plenty of research
under my belt before being asked what my thoughts are. He was talking
about using the Zend Framework with PHP, but I want to avoid that if
possible. Django seems like one of the best MVC solutions in the
Python arena. I would be willing to replace Django's ORM solution with
something else, especially if it supported POPOs. I could even map all
of the non-POPOs to POPOs if I needed to, I guess.

Finally, I wanted to ask whether anyone has tried having Django call
out to Python 3 routines. I am okay using Python 2.7 in Django, if I
can have the controllers call business logic implemented in Python 3,
accepting POPOs from the data layer. Django would really just be a
coordinator: grab data from Django ORM, convert results into POPOs,
load up Python 3 module with business logic, passing POPOs, returning
POPOs and then converting those to view models. I'm sweating just
thinking about it. My guess is that there would be a severe penalty
for crossing process boundaries... but any insights would be
appreciated.

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


Re: Python ORMs Supporting POPOs and Substituting Layers in Django

2011-11-05 Thread Marco Nawijn
On Nov 5, 9:11 pm, Travis Parks  wrote:
> Hello:
>
> A new guy showed up at work a few weeks ago and has started talking
> about replacing a 6 month old project, written in ASP.NET MVC, with an
> open source solution that can handle massive scaling. I think his
> primary concern is the "potential" need for massive web farms in the
> future. In order to prevent high licensing costs, I think he wants to
> move everything to open source technologies, such as the LAMP stack. I
> also don't think he truly understands what ASP.NET MVC is and thinks
> it is the older WebForms.
>
> I have been researching open source MVC frameworks and came across
> Django. It looks like an awesome tool, but I am willing to look at
> others. I have experience in Python (and enough in PHP to want to
> avoid it and absolutely none in Ruby) so I think it would be a good
> language to develop in.
>
> I was wondering if there were any ORMs for Python that used POPOs
> (plain old Python objects). There is a lot of business logic in my
> system, and so I want to keep my data objects simple and stupid. I
> want the ORM to be responsible for detecting changes to objects after
> I send them back to the data layer (rather than during business layer
> execution). Additionally, being a stateless environment, tracking
> objects' states isn't very useful anyway.
>
> Honestly, I doubt this guy is going to get his wish. The people paying
> for the application aren't going to be willing to throw 6 months of
> work down the drain. Never the less, I want to have plenty of research
> under my belt before being asked what my thoughts are. He was talking
> about using the Zend Framework with PHP, but I want to avoid that if
> possible. Django seems like one of the best MVC solutions in the
> Python arena. I would be willing to replace Django's ORM solution with
> something else, especially if it supported POPOs. I could even map all
> of the non-POPOs to POPOs if I needed to, I guess.
>
> Finally, I wanted to ask whether anyone has tried having Django call
> out to Python 3 routines. I am okay using Python 2.7 in Django, if I
> can have the controllers call business logic implemented in Python 3,
> accepting POPOs from the data layer. Django would really just be a
> coordinator: grab data from Django ORM, convert results into POPOs,
> load up Python 3 module with business logic, passing POPOs, returning
> POPOs and then converting those to view models. I'm sweating just
> thinking about it. My guess is that there would be a severe penalty
> for crossing process boundaries... but any insights would be
> appreciated.
>
> Thanks,
> Travis Parks

Hello Travis,

I am not an expert in the field,  but I have used SQLAlchemy
(www.sqlalchemy.org)
for a while and was very happy with it. It should be able to scale up
to pretty
complex applications and large amounts of data.

Regards,

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


Re: Python ORMs Supporting POPOs and Substituting Layers in Django

2011-11-05 Thread Chris Angelico
On Sun, Nov 6, 2011 at 7:11 AM, Travis Parks  wrote:
> Finally, I wanted to ask whether anyone has tried having Django call
> out to Python 3 routines. I am okay using Python 2.7 in Django, if I
> can have the controllers call business logic implemented in Python 3,
> accepting POPOs from the data layer.

What you're going to have is completely separate processes; either
invoking Python3 and having it terminate after one action, or keeping
it running concurrently and passing data between them.

Has anyone ever extended AND embedded Python at the same time? Written
a Python module that ... executes Python code? Might be a bit tricky,
but possibly isolating the Py2 and Py3 code into different C source
files would help conserve programmer sanity (at the possible cost of
performance). Would be a tricky thing to juggle, but if you can pull
it off, you'd be able to - effectively - have a module in Django
that's written in Python 3, and directly callable.

Propagating parameters and return values would be a matter of
unpacking them into C objects and repacking them on the other side.
Propagating exceptions would be fun?

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


Re: Python ORMs Supporting POPOs and Substituting Layers in Django

2011-11-05 Thread Travis Parks
On Nov 5, 4:11 pm, Travis Parks  wrote:
> Hello:
>
> A new guy showed up at work a few weeks ago and has started talking
> about replacing a 6 month old project, written in ASP.NET MVC, with an
> open source solution that can handle massive scaling. I think his
> primary concern is the "potential" need for massive web farms in the
> future. In order to prevent high licensing costs, I think he wants to
> move everything to open source technologies, such as the LAMP stack. I
> also don't think he truly understands what ASP.NET MVC is and thinks
> it is the older WebForms.
>
> I have been researching open source MVC frameworks and came across
> Django. It looks like an awesome tool, but I am willing to look at
> others. I have experience in Python (and enough in PHP to want to
> avoid it and absolutely none in Ruby) so I think it would be a good
> language to develop in.
>
> I was wondering if there were any ORMs for Python that used POPOs
> (plain old Python objects). There is a lot of business logic in my
> system, and so I want to keep my data objects simple and stupid. I
> want the ORM to be responsible for detecting changes to objects after
> I send them back to the data layer (rather than during business layer
> execution). Additionally, being a stateless environment, tracking
> objects' states isn't very useful anyway.
>
> Honestly, I doubt this guy is going to get his wish. The people paying
> for the application aren't going to be willing to throw 6 months of
> work down the drain. Never the less, I want to have plenty of research
> under my belt before being asked what my thoughts are. He was talking
> about using the Zend Framework with PHP, but I want to avoid that if
> possible. Django seems like one of the best MVC solutions in the
> Python arena. I would be willing to replace Django's ORM solution with
> something else, especially if it supported POPOs. I could even map all
> of the non-POPOs to POPOs if I needed to, I guess.
>
> Finally, I wanted to ask whether anyone has tried having Django call
> out to Python 3 routines. I am okay using Python 2.7 in Django, if I
> can have the controllers call business logic implemented in Python 3,
> accepting POPOs from the data layer. Django would really just be a
> coordinator: grab data from Django ORM, convert results into POPOs,
> load up Python 3 module with business logic, passing POPOs, returning
> POPOs and then converting those to view models. I'm sweating just
> thinking about it. My guess is that there would be a severe penalty
> for crossing process boundaries... but any insights would be
> appreciated.
>
> Thanks,
> Travis Parks

Which web frameworks have people here used and which have they found
to be: scalable, RAD compatible, performant, stable and/or providing
good community support? I am really trying to get as much feedback as
I can, to help form an unbiased opinion in case I need to make a
recommendation... or fight an all out battle.
-- 
http://mail.python.org/mailman/listinfo/python-list


What would happen when lisp meets prolog in python? Dao and Dinpy arises!

2011-11-05 Thread Simeon Chaos
Dao is the new generation programming system implemented by a
functional logic solver,
unifying code with data, grammar with program, logic with functional,
compiling with running.

Would you please to have a look at my dao and dinpy?
http://pypi.python.org/pypi/daot
https://github.com/chaosim/dao

The feature of dao and dinpy:
* Mix functional and logic programming like prolog and lisp in python.
* A most powerful parser is provided, which have the power all of the
other parsers do not have. below is the list of some parser and
algorithms: parsec(haskell), packrat, earley parser, glr parser,
antlr, lex/yacc.
  What's the magic behind the dao? See samples\sexpression.py and
testsexpression.py for a sample.

  this is the key tips to the dao's dynamic grammar, which will become
a most powerful tool:

  (sexpression, function(
 # dynamic grammar arises!
([Result], and_p(char('{'), sexpression(Expr2), char('}'),
 setvalue(Result,
eval_(pycall(sexpression2daoexpression, Expr2),

([Expr], atom_expression(Expr)),
([Expr], bracketExpression(Expr)),
([Expr], puncExpression(Expr))),

  # the kernel of dynamic grammar
  (eval_parse_result, function(
([Result], and_p(sexpression(Expr2), eoi,
  is_(Result, eval_(pycall(sexpression2daoexpression,
Expr2))),
-- 
http://mail.python.org/mailman/listinfo/python-list