Re: Fast GUI pipemeter: gprog

2010-03-06 Thread Dan Stromberg
On Mar 4, 4:25 pm, Dan Stromberg  wrote:

> Python folk: Any guesses why a simple file.read(blocksize) would have
> such an affinity for returning 16K when redirected from /dev/zero?  If
> I run the program against a file on disk, it gets larger blocksizes
> fine.

Never mind - it was a bug in my code.

Now on a slower machine, it runs about 2.5 times faster than it did on
the faster machine.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: start function in new process

2010-03-06 Thread wongjoek...@yahoo.com
On 5 mrt, 21:40, "Martin P. Hellwig" 
wrote:
> On 03/05/10 20:09, wongjoek...@yahoo.com wrote:
>
>
>
> > On 5 mrt, 21:02, "Martin P. Hellwig"
> > wrote:
> >> On 03/05/10 19:45, wongjoek...@yahoo.com wrote:
>
> >>> On 5 mrt, 20:40, "Martin P. Hellwig"
> >>> wrote:
>  On 03/05/10 19:21, wongjoek...@yahoo.com wrote:
>  
>  Any specific reason why threading.Thread or multiprocessing is not
>  suitable to solve your problem?
>
>  --
>  mph
>
> >>> Because I got a memory leak in my function f(). It uses scipy, numpy,
> >>> pylab, and I am not planning to solve the memory leak because its too
> >>> complicated. So I thought of just calling the function then when it is
> >>> finished the process is gone and all memory is released. With
> >>> threading I don't think I would solve this problem. I am not sure
> >>> though.
>
> >> I would be surprised if you can't do the same with
> >> subprocess/multiprocessing, since you seem to know how to identify the
> >> memory leak it shouldn't be a problem scripting out a test to see if it
> >> works this way. I would be interested though in your findings.
>
> >> --
> >> mph
>
> > I can't use multiprocessing module since it comes only with python 2.6
> > and I am bound to python2.4. But subprocess does exist in python2.4,
> > but the question now is, how do I achieve that ? Any example ?
>
> Sure, for example if I want to check the openssl version (didn't specify
> I need to provide a useful example :-)
>
> I would normally do on the command line:
> [mar...@aspire8930 /usr/home/martin/Desktop]$ /usr/bin/openssl version
> OpenSSL 0.9.8k 25 Mar 2009
>
> The python subprocess equivalent is:
> [mar...@aspire8930 /usr/home/martin/Desktop]$ python
> Python 2.6.4 (r264:75706, Jan 31 2010, 20:52:16)
> [GCC 4.2.1 20070719  [FreeBSD]] on freebsd8
> Type "help", "copyright", "credits" or "license" for more information.
>  >>> import subprocess as _sp
>  >>> ssl_version = _sp.Popen(['/usr/bin/openssl', 'version'],
> stdout=_sp.PIPE)
>  >>> print(ssl_version.stdout.readlines())
> ['OpenSSL 0.9.8k 25 Mar 2009\n']
>  >>> quit()
> [mar...@aspire8930 /usr/home/martin/Desktop]$
>
> If you get any error in the Popen part, you probably did not use the
> full path or an illegal parameter.
>
> If you get a long wait in the readlines part, this usually means that
> there is either nothing written to stdout or something is still being
> written (I am not sure about this part though, it has been a while).
>
> hth
> --
> mph

Yes, I saw this example also before. HOwever what I want is to call an
internal function which gets a reference of another internal function
as input and not calling an external program. Do you have any example
on that with subprocess module ?
Thanks.
-- 
http://mail.python.org/mailman/listinfo/python-list


compiler with python

2010-03-06 Thread mohamed issolah
hey,

How can I construct a compiler with python just for informatiom ., I have
habit to construct it with C language,

sorry for my english ;-)
-- 
issolah mohamed
-- 
http://mail.python.org/mailman/listinfo/python-list


Building Python-2.6.4 on G/L: can't build in _ssl support.

2010-03-06 Thread Alan Mackenzie
Hi, Python!

I build Python-2.6.4 on my GNU/Linux (Debian Sarge) box.  I get a warning
message "Failed to find the necessary bits to build these modules: 
_ssl ...  RTFS to find out what!".

I need _ssl for an application.  So, I look at setup.py in the top
directory.  It seems that _ssl needs to find certain .h files, but is
looking in /usr/local/ssl and /usr/contrib (or subdirectories thereof).
These look like highly non-standard directories.

Either something is hugely amiss, or I'm missing some vital nugget of
information (possibly through not being a Python hacker).

Would somebody please give me a tip to get this sorted out?  Thanks!

-- 
Alan Mackenzie (Nuremberg, Germany).

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


Re: compiler with python

2010-03-06 Thread Dave Angel

mohamed issolah wrote:

hey,

How can I construct a compiler with python just for informatiom ., I have
habit to construct it with C language,

sorry for my english ;-)
  
You need to tell us what you're really trying to do, what tools you're 
willing to use, and probably why you want it.  And if you're not sure 
about your English, keep the sentence structure straightforward.


Let me make a couple of wild guesses:

You want to design and build a compiler that takes xml information as 
its source code, and compiles those xml files into Intel x86 machine 
code.  The compiler and the resulting executable needs to run on an x86 
Linux machine.  Your previous experience was in doing this sort of thing 
in C, but you want to try it with Python instead.  You want to do it 
without using the lxml libraries.


You want to build a python compiler, that takes python source code and 
produces Java byte code files.  You'd like to do this in C, but don't 
want to use any of the available existing CPython or Jython source 
code.  Your goal is not to make a commercially viable product, but to 
learn as much as possible in the process.



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


Import problem

2010-03-06 Thread Johny
I have this directory structure

C:
  \A
 __init__.py
 amodule.py

 \B
  __init__.py
  bmodule.py

   \D
__init__.py
dmodule.py

and  I want to import  bmodule.py
C:\>cd \

C:\>python
Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit
(Intel)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> from A.B import  bmodule
I am bmodule
>>>
C:\>

so far so good. Now I would like to import bmodule but if the current
directory is \D subdirectory.

C:> cd \A\B\D
C:\A\B\D>
C:\A\B\D>python
Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit
(Intel)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path.append('C:\\A')
>>> from A.B import bmodule
Traceback (most recent call last):
  File "", line 1, in 
ImportError: No module named A.B

C:\>

so I can not import a module from the parent directory? Or where did I
make an error?
Thanks for help

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


Re: start function in new process

2010-03-06 Thread Martin P. Hellwig

On 03/06/10 09:45, wongjoek...@yahoo.com wrote:



Yes, I saw this example also before. HOwever what I want is to call an
internal function which gets a reference of another internal function
as input and not calling an external program. Do you have any example
on that with subprocess module ?
Thanks.


Well yes that is possible but you would more or less be just reinventing 
parts of the multiprocessing module, so I would use that one (at the 
location Robert Kern suggested).


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


compiler with python

2010-03-06 Thread mohamed issolah
hey,

I want to create a compiler which transform a code like pascal code (that
what I do in C) to "quad"
In C, I use BISON and FLEX tools.
-- 
issolah mohamed
-- 
http://mail.python.org/mailman/listinfo/python-list


"olivia wilde" "olivia williams" "olivia" "olivia" "olivia" "virgin women" "virgin girl test" on http://sexyandpretty-girls.blogspot.com/ "torrie wilson playboy march 2004" "torrie wilson" "torrie wi

2010-03-06 Thread Naeem
"olivia wilde" "olivia williams" "olivia" "olivia" "olivia" "virgin
women" "virgin girl test" on http://sexyandpretty-girls.blogspot.com/
"torrie wilson playboy march 2004" "torrie wilson" "torrie wilson no
clothes" "torrie wilson 2009" ""olivia wilde" "olivia williams"
"olivia" "olivia" "olivia" "virgin women" "virgin girl test" on
http://sexyandpretty-girls.blogspot.com/  "torrie wilson
playboy march 2004" "torrie wilson" "torrie wilson no clothes" "torrie
wilson 2009" ""olivia wilde" "olivia williams" "olivia" "olivia"
"olivia" "virgin women" "virgin girl test" on 
http://sexyandpretty-girls.blogspot.com/
"torrie wilson playboy march 2004" "torrie wilson" "torrie wilson no
clothes" "torrie wilson 2009" ""olivia wilde" "olivia williams"
"olivia" "olivia" "olivia" "virgin women" "virgin girl test" on
http://sexyandpretty-girls.blogspot.com/  "torrie wilson
playboy march 2004" "torrie wilson" "torrie wilson no clothes" "torrie
wilson 2009" ""olivia wilde" "olivia williams" "olivia" "olivia"
"olivia" "virgin women" "virgin girl test" on 
http://sexyandpretty-girls.blogspot.com/
"torrie wilson playboy march 2004" "torrie wilson" "torrie wilson no
clothes" "torrie wilson 2009" ""olivia wilde" "olivia williams"
"olivia" "olivia" "olivia" "virgin women" "virgin girl test" on
http://sexyandpretty-girls.blogspot.com/  "torrie wilson
playboy march 2004" "torrie wilson" "torrie wilson no clothes" "torrie
wilson 2009" ""olivia wilde" "olivia williams" "olivia" "olivia"
"olivia" "virgin women" "virgin girl test" on 
http://sexyandpretty-girls.blogspot.com/
"torrie wilson playboy march 2004" "torrie wilson" "torrie wilson no
clothes" "torrie wilson 2009" ""olivia wilde" "olivia williams"
"olivia" "olivia" "olivia" "virgin women" "virgin girl test" on
http://sexyandpretty-girls.blogspot.com/  "torrie wilson
playboy march 2004" "torrie wilson" "torrie wilson no clothes" "torrie
wilson 2009" ""olivia wilde" "olivia williams" "olivia" "olivia"
"olivia" "virgin women" "virgin girl test" on 
http://sexyandpretty-girls.blogspot.com/
"torrie wilson playboy march 2004" "torrie wilson" "torrie wilson no
clothes" "torrie wilson 2009" ""olivia wilde" "olivia williams"
"olivia" "olivia" "olivia" "virgin women" "virgin girl test" on
http://sexyandpretty-girls.blogspot.com/  "torrie wilson
playboy march 2004" "torrie wilson" "torrie wilson no clothes" "torrie
wilson 2009" ""olivia wilde" "olivia williams" "olivia" "olivia"
"olivia" "virgin women" "virgin girl test" on 
http://sexyandpretty-girls.blogspot.com/
"torrie wilson playboy march 2004" "torrie wilson" "torrie wilson no
clothes" "torrie wilson 2009" ""olivia wilde" "olivia williams"
"olivia" "olivia" "olivia" "virgin women" "virgin girl test" on
http://sexyandpretty-girls.blogspot.com/  "torrie wilson
playboy march 2004" "torrie wilson" "torrie wilson no clothes" "torrie
wilson 2009" ""olivia wilde" "olivia williams" "olivia" "olivia"
"olivia" "virgin women" "virgin girl test" on 
http://sexyandpretty-girls.blogspot.com/
"torrie wilson playboy march 2004" "torrie wilson" "torrie wilson no
clothes" "torrie wilson 2009" ""olivia wilde" "olivia williams"
"olivia" "olivia" "olivia" "virgin women" "virgin girl test" on
http://sexyandpretty-girls.blogspot.com/  "torrie wilson
playboy march 2004" "torrie wilson" "torrie wilson no clothes" "torrie
wilson 2009" ""olivia wilde" "olivia williams" "olivia" "olivia"
"olivia" "virgin women" "virgin girl test" on 
http://sexyandpretty-girls.blogspot.com/
"torrie wilson playboy march 2004" "torrie wilson" "torrie wilson no
clothes" "torrie wilson 2009" ""olivia wilde" "olivia williams"
"olivia" "olivia" "olivia" "virgin women" "virgin girl test" on
http://sexyandpretty-girls.blogspot.com/  "torrie wilson
playboy march 2004" "torrie wilson" "torrie wilson no clothes" "torrie
wilson 2009" ""olivia wilde" "olivia williams" "olivia" "olivia"
"olivia" "virgin women" "virgin girl test" on 
http://sexyandpretty-girls.blogspot.com/
"torrie wilson playboy march 2004" "torrie wilson" "torrie wilson no
clothes" "torrie wilson 2009" ""olivia wilde" "olivia williams"
"olivia" "olivia" "olivia" "virgin women" "virgin girl test" on
http://sexyandpretty-girls.blogspot.com/  "torrie wilson
playboy march 2004" "torrie wilson" "torrie wilson no clothes" "torrie
wilson 2009" ""olivia wilde" "olivia williams" "olivia" "olivia"
"olivia" "virgin women" "virgin girl test" on 
http://sexyandpretty-girls.blogspot.com/
"torrie wilson playboy march 2004" "torrie wilson" "torrie wilson no
clothes" "torrie wilson 2009" ""olivia wilde" "olivia williams"
"olivia" "olivia" "olivia" "virgin women" "virgin girl test" on
http://sexyandpretty-girls.blogspot.com/  "torrie wilson
playboy march 2004" "torrie wilson" "torrie wilson no clothes" "torrie
wilson 2009" ""olivia wilde" "olivia williams" "olivia" "olivia"
"olivia" "virgin women" "virgin girl test" on 
http://sexyandpretty-girls.blogspot.com/
"

Re: Import problem

2010-03-06 Thread Steven D'Aprano
On Sat, 06 Mar 2010 03:53:53 -0800, Johny wrote:

 import sys
 sys.path.append('C:\\A')
 from A.B import bmodule
> Traceback (most recent call last):
>   File "", line 1, in 
> ImportError: No module named A.B

The current directory is irrelevant, except that it is automatically 
added to the PYTHONPATH. That's why you can import A.B when the current 
directory is C.

You are trying to import module B from package A *inside* directory C:\A, 
but there is no such package A inside C:\A. You need to add C to the 
path, and then it should work.




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


Call for Paper The International Journal of Computer Science (IJCS)

2010-03-06 Thread editor ijcs
Call for Paper
The International Journal of Computer Science (IJCS) publishes
original papers on all subjects relevant to computer science,
communication network, and information systems. The highest priority
will be given to those contributions concerned with a discussion of
the background of a practical problem, the establishment of an
appropriate model, the determination of a solution, approximate or
exact, analytical or numerical, and a discussion of the relevance of
the results when applied to the real-life problem. Paper submissions
are invited in the area of computer science, in particular the
technological advances and research results in the fields of
theoretical, experimental, applied electronics, computer science,
communication network and Information technology.
Topics of interest include but are not limited to the following:
 Computer Science

* Parallel Processing and Distributed Computing
* Foundations of High-performance Computing
* Graph Theory and Analysis of Algorithms
* Artificial Intelligences and Pattern/Image Recognitions
* Neural Networks and Biomedical Simulations
* Virtual Visions and Virtual Simulations
* Data Mining, Web Image Mining and Applications
* Data Base Management & Information Retrievals Adaptive Systems
* Bifurcation, Biocybernetics & Bioinformatics
* Blind Systems, Neural Networks &Control Systems
* Cryptosystems &Data Compression
* Evolutional Computation &Fuzzy Systems
* Image Processing and Image Recognition, Modeling & Optimization
* Speech Processing, Speech Synthesis & Speech Recognition
* Video Signal Processing, Watermarking & Wavelet Transform
* All topics related Computer Science

Communication Network

* Quantum Computing & Coding
* Error Controls Agent Computing & Multi-Agents Systems
* Defining Spectrum Rights and Open Spectrum Solutions
* Quality of Services and Communication Protocols
* Satellite and Optical Communication Systems
* 3G/4G Network Evolutions & CDMA/GSM Communication Protocols
* Mobile Computing, Transmission/Switching/Distribution
technologies
* Communication Theory & Signal Processing for Communications
* Wireless Communications, Wireless & Mobile Networking
* Optical Networks and Systems &Next-Generation Networking and
Internet
* Communication QoS &Reliability and Modeling
* Ad-hoc, Sensor & Mesh Networking
* Multimedia Services, Communication Software & Services
* Communication and Information System Security
* System control and network/service management
* Network and Internet protocols and standards
* Client-server, distributed & Web-based communication systems
* Broadband and multimedia systems & applications
* Trials of advanced systems and services
* Any topics related Communication Network

Information and Systems

* Cryptography and Foundation of Computer Security
* Authentication/Authorization Issues
* IDS/Firewall, Anti-Spam mail & Anti-virus issues
* Biometric authentication & algorithms
* Fingerprint /Hand/Biometrics Recognitions and Technologies
* IC-card Security, OTP & Key Management Issues
* E-commerce, Ubiquitous & RFID Applications
* Metadata, Meta Modeling, XML & Data Management
* Knowledge Management, Web Security & Privacy
* Cyber Threats, Web Services & Web Engineering
* Web Intelligence, Protocols & Standards
* Proxies and Servers
* Multimedia Applications
* Ontology and the Semantic Web
* B2B, B2C and C2C
* E-Business System Design and Development, E-Payment
* Portal Strategies, Social Networks and Information Systems
* Social and Legal Issues and Digital Ecology
* E-Governance, E-Learning and Virtual Classrooms
* E-Entertainment, E-Journalism
* Any topics related Information systems

   Electronics

* Circuits & Devices
* Communication Networks & Systems
* Communications & Information Processing
* Digital Signal Processing & Electrical Engineering
Communications
* Electromagnetics & Microwaves
* Instrumentation
* Measurement & Testing
* Nanoscience & Nanotechnology
* Optics & Optoelectronic Effects
* Devices, Systems &Semiconductors
* Systems & Control Engineering
* Telecommunications
* Any topics related Electronics

International Journal of Computer Science (IJCS)
ISSN: 1884-9083
Website: https://sites.google.com/site/ijcsorg/
Manuscript submission to: ijcsorgedi...@gmail.com

All submitted papers will be judged based on their quality by the
technical committee and reviewers. Papers that describe research and
experimentation are encouraged. All paper submissions will be handled
electronically and detailed instructions on submission procedure are
available on IJCS web pages. Researchers and authors are invited to
participate in the peer-review process of IJCS papers if your research
interest matches with the themes of Call for Pap

intersting datt with girls.......sign in to this website

2010-03-06 Thread karan arjun
RE U WANT RUSSIAN GIRL FRIENDS...
WEBPAGE ---> http://123maza.com/hashan/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: compiler with python

2010-03-06 Thread Dave Angel

mohamed issolah wrote:


2010/3/6 Dave Angel 

  

mohamed issolah wrote:



hey,

How can I construct a compiler with python just for informatiom ., I have
habit to construct it with C language,

sorry for my english ;-)


  

You need to tell us what you're really trying to do, what tools you're
willing to use, and probably why you want it.  And if you're not sure about
your English, keep the sentence structure straightforward.

Let me make a couple of wild guesses:





  

You want to design and build a compiler that takes xml information as its
source code, and compiles those xml files into Intel x86 machine code.  The
compiler and the resulting executable needs to run on an x86 Linux machine.
 Your previous experience was in doing this sort of thing in C, but you want
to try it with Python instead.  You want to do it without using the lxml
libraries.

You want to build a python compiler, that takes python source code and
produces Java byte code files.  You'd like to do this in C, but don't want
to use any of the available existing CPython or Jython source code.  Your
goal is not to make a commercially viable product, but to learn as much as
possible in the process.


DaveA




hey,

I want to create a compiler which transform a code like pascal code (that
what I do in C) to "quad"
In C, I use BISON and FLEX tools.


  
I've forwarded your message to the list, and fixed your top-posting by 
moving your response to the bottom.  I don't have a clue what "quad" is, 
unless it's a synonym for Forth.


You haven't specified the OS you'll be using to run the compiler, nor 
the one you're targeting, so some of these choices may not be useful.  
For example, the first one is Linux only.


http://www.freenet.org.nz/python/pybison/
PyBison - Python binding for Bison/Flex

http://freshmeat.net/projects/yeanpypa/
http://www.slash-me.net/dev/snippets/yeanpypa/documentation.html

http://www.python.org/community/sigs/retired/parser-sig/towards-standard/

Or you could go here, which has links to (most of) these and others.
http://wiki.python.org/moin/LanguageParsing

DaveA





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


Re: best practices: is collections.defaultdict my friend or not?

2010-03-06 Thread Bruno Desthuilliers
Pete Emerson a écrit :
(snip)
> I'm really liking the rigid flexibility I'm experiencing with python
> so far.

"rigid flexibility" !-)

+1 QOTW - and welcome on board BTW.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Building Python-2.6.4 on G/L: can't build in _ssl support.

2010-03-06 Thread Anssi Saari
Alan Mackenzie  writes:

> Hi, Python!
>
> I build Python-2.6.4 on my GNU/Linux (Debian Sarge) box.  I get a warning
> message "Failed to find the necessary bits to build these modules: 
> _ssl ...  RTFS to find out what!".

At a guess, you're missing libssl-dev. You might consider installing
python2.6 or python2.6-minimal from unstable or testing too.

> I need _ssl for an application.  So, I look at setup.py in the top
> directory.  It seems that _ssl needs to find certain .h files, but is
> looking in /usr/local/ssl and /usr/contrib (or subdirectories thereof).
> These look like highly non-standard directories.

Looks to me like it looks in those non-standard directories, but in
addition to normal /usr/include.
-- 
http://mail.python.org/mailman/listinfo/python-list


Escape curly bracket together to a variable extension

2010-03-06 Thread Joan Miller
How to escape the first '}' in the next string?

s = "}\n{0}".format('foo')
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Escape curly bracket together to a variable extension

2010-03-06 Thread Alf P. Steinbach

* Joan Miller:

How to escape the first '}' in the next string?

s = "}\n{0}".format('foo')


s = "}}\n{0}".format('foo')


Cheers & hth.,

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


Re: Escape curly bracket together to a variable extension

2010-03-06 Thread Gary Herron

Joan Miller wrote:

How to escape the first '}' in the next string?

s = "}\n{0}".format('foo')
  

>>> "}}\n{0}".format('foo')
'}\nfoo'


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


Re: compiler with python

2010-03-06 Thread Steven Howe
Is it possible he's talking about a 'quad core'? as in a CPU? In that 
case I think he wants

to optimize a python program for a multiprocessor core with four processors.

sph


On 03/06/2010 07:56 AM, Dave Angel wrote:

mohamed issolah wrote:


2010/3/6 Dave Angel 


mohamed issolah wrote:


hey,

How can I construct a compiler with python just for informatiom ., 
I have

habit to construct it with C language,

sorry for my english ;-)



You need to tell us what you're really trying to do, what tools you're
willing to use, and probably why you want it.  And if you're not 
sure about

your English, keep the sentence structure straightforward.

Let me make a couple of wild guesses:




You want to design and build a compiler that takes xml information 
as its
source code, and compiles those xml files into Intel x86 machine 
code.  The
compiler and the resulting executable needs to run on an x86 Linux 
machine.
 Your previous experience was in doing this sort of thing in C, but 
you want
to try it with Python instead.  You want to do it without using the 
lxml

libraries.

You want to build a python compiler, that takes python source code and
produces Java byte code files.  You'd like to do this in C, but 
don't want
to use any of the available existing CPython or Jython source code.  
Your
goal is not to make a commercially viable product, but to learn as 
much as

possible in the process.


DaveA



hey,

I want to create a compiler which transform a code like pascal code 
(that

what I do in C) to "quad"
In C, I use BISON and FLEX tools.


I've forwarded your message to the list, and fixed your top-posting by 
moving your response to the bottom.  I don't have a clue what "quad" 
is, unless it's a synonym for Forth.


You haven't specified the OS you'll be using to run the compiler, nor 
the one you're targeting, so some of these choices may not be useful.  
For example, the first one is Linux only.


http://www.freenet.org.nz/python/pybison/
PyBison - Python binding for Bison/Flex

http://freshmeat.net/projects/yeanpypa/
http://www.slash-me.net/dev/snippets/yeanpypa/documentation.html

http://www.python.org/community/sigs/retired/parser-sig/towards-standard/

Or you could go here, which has links to (most of) these and others.
http://wiki.python.org/moin/LanguageParsing

DaveA

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


Re: compiler with python

2010-03-06 Thread Alf P. Steinbach
Since Mohamed is talking about compilation I think it's more likely he's talking 
about an intermediate program represention based on quad tuples like


  (OP, DESTINATION, ARG1, ARG2)

Cheers,

- Alf


* Steven Howe:
Is it possible he's talking about a 'quad core'? as in a CPU? In that 
case I think he wants
to optimize a python program for a multiprocessor core with four 
processors.


sph


On 03/06/2010 07:56 AM, Dave Angel wrote:

mohamed issolah wrote:


2010/3/6 Dave Angel 


mohamed issolah wrote:


hey,

How can I construct a compiler with python just for informatiom ., 
I have

habit to construct it with C language,

sorry for my english ;-)



You need to tell us what you're really trying to do, what tools you're
willing to use, and probably why you want it.  And if you're not 
sure about

your English, keep the sentence structure straightforward.

Let me make a couple of wild guesses:




You want to design and build a compiler that takes xml information 
as its
source code, and compiles those xml files into Intel x86 machine 
code.  The
compiler and the resulting executable needs to run on an x86 Linux 
machine.
 Your previous experience was in doing this sort of thing in C, but 
you want
to try it with Python instead.  You want to do it without using the 
lxml

libraries.

You want to build a python compiler, that takes python source code and
produces Java byte code files.  You'd like to do this in C, but 
don't want
to use any of the available existing CPython or Jython source code.  
Your
goal is not to make a commercially viable product, but to learn as 
much as

possible in the process.


DaveA



hey,

I want to create a compiler which transform a code like pascal code 
(that

what I do in C) to "quad"
In C, I use BISON and FLEX tools.


I've forwarded your message to the list, and fixed your top-posting by 
moving your response to the bottom.  I don't have a clue what "quad" 
is, unless it's a synonym for Forth.


You haven't specified the OS you'll be using to run the compiler, nor 
the one you're targeting, so some of these choices may not be useful.  
For example, the first one is Linux only.


http://www.freenet.org.nz/python/pybison/
PyBison - Python binding for Bison/Flex

http://freshmeat.net/projects/yeanpypa/
http://www.slash-me.net/dev/snippets/yeanpypa/documentation.html

http://www.python.org/community/sigs/retired/parser-sig/towards-standard/

Or you could go here, which has links to (most of) these and others.
http://wiki.python.org/moin/LanguageParsing

DaveA

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


compiler with python

2010-03-06 Thread mohamed issolah
hey, yes quad = quad tuple like ("+",x1,x2,temp)
I work in linux
example : my parser with flex :


-- 
issolah mohamed


token.l
Description: Binary data
-- 
http://mail.python.org/mailman/listinfo/python-list


[RELEASED] Python 3.1.2 release candidate

2010-03-06 Thread Benjamin Peterson
On behalf of the Python development team, I'm pleased to announce a release
candidate for the second bugfix release of the Python 3.1 series, Python 3.1.2.

This bug fix release fixes numerous issues found in 3.1.1.  This release
candidate has been released to solicit testing and feedback over an possible
regressions from 3.1.1.  Please consider testing it with your library or
application and reporting an bugs you encounter.  This will help make the final
3.1.2 release, planned in 2 weeks time, all the more stable.

The Python 3.1 version series focuses on the stabilization and optimization of
the features and changes that Python 3.0 introduced.  For example, the new I/O
system has been rewritten in C for speed.  File system APIs that use unicode
strings now handle paths with undecodable bytes in them. Other features include
an ordered dictionary implementation, a condensed syntax for nested with
statements, and support for ttk Tile in Tkinter.  For a more extensive list of
changes in 3.1, see http://doc.python.org/3.1/whatsnew/3.1.html or Misc/NEWS in
the Python distribution.

To download Python 3.1.2rc1 visit:

 http://www.python.org/download/releases/3.1.2/

A list of changes in 3.1.2rc1 can be found here:

 http://svn.python.org/projects/python/tags/r312rc1/Misc/NEWS

The 3.1 documentation can be found at:

 http://docs.python.org/3.1

Bugs can always be reported to:

 http://bugs.python.org


Enjoy!

--
Benjamin Peterson
Release Manager
benjamin at python.org
(on behalf of the entire python-dev team and 3.1.2's contributors)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Conditional based on whether or not a module is being used

2010-03-06 Thread Vinay Sajip
On Mar 5, 9:29 pm, Pete Emerson  wrote:
>
> I have written my first module called "logger" that logs to syslog via
> the syslog module but also allows forloggingto STDOUT in debug mode
> at multiple levels (to increase verbosity depending on one's need), or
> both. I've looked at theloggingmodule and while it might suit my
> needs, it's overkill for me right now (I'm still *very* much a python
> newbie).
>

Overkill in what sense? You just need to write a few lines of code to
be able to use the logging package which comes with Python:

import logging, logging.handlers, sys
logging.basicConfig(level=logging.DEBUG, stream=sys.stdout)
logging.getLogger().addHandler(logging.handlers.SysLogHandler())
# default logs to syslog at (localhost, 514) with facility LOG_USER
# you can change the default to use e.g. Unix domain sockets and a
different facility

So you're experienced enough and have time enough to write your own
logger module, but too much of a newbie to use a module which is part
of Python's included batteries? If you're writing something like
logging to learn about it and what the issues are, that's fair enough.
But I can't see what you mean by overkill, exactly. The three lines
above (or thereabouts) will, I believe, let you log to syslog and to
stdout...which is what you say you want to do.

> I want to write other modules, and my thinking is that it makes sense
> for those modules to use the "logger" module to do thelogging, if and
> only if the parent using the other modules is also using the logger
> module.
>
> In other words, I don't want to force someone to use the "logger"
> module just so they can use my other modules, even if the "logger"
> module is installed ... but I also want to take advantage of it if I'm
> using it.
>
> Now that I've written that, I'm not sure that makes a whole lot of
> sense. It seems like I could say, "hey, this person has the 'logger'
> module available, let's use it!".
>
> Thoughts?

Well, the logging package is available in Python and ready for use and
pretty much battle tested, so why not use that? Are you planning to
use third-party libraries in your Python work, or write everything
yourself? If you are planning to use third party libraries, how would
their logging be hooked into your logger module? And if not, is it
good to have two logging systems in parallel?

Of course as the maintainer of Python's logging package, you'd expect
me to be biased in favour of it. You maybe shouldn't let that sway
you ;-)

Regards,


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


[RELEASED] Python 2.7 alpha 4

2010-03-06 Thread Benjamin Peterson
On behalf of the Python development team, I'm overjoyed to announce the fourth
alpha release of Python 2.7.

Python 2.7 is scheduled (by Guido and Python-dev) to be the last major version
in the 2.x series.  Though more major releases have not been absolutely ruled
out, it's likely that the 2.7 release will an extended period of maintenance for
the 2.x series.

2.7 includes many features that were first released in Python 3.1.  The faster
io module, the new nested with statement syntax, improved float repr, set
literals, dictionary views, and the memoryview object have been backported from
3.1. Other features include an ordered dictionary implementation, unittests
improvements, a new sysconfig module, and support for ttk Tile in Tkinter.  For
a more extensive list of changes in 2.7, see
http://doc.python.org/dev/whatsnew/2.7.html or Misc/NEWS in the Python
distribution.

To download Python 2.7 visit:

 http://www.python.org/download/releases/2.7/

Please note that this is a development release, intended as a preview of new
features for the community, and is thus not suitable for production use.

The 2.7 documentation can be found at:

 http://docs.python.org/2.7

Please consider trying Python 2.7 with your code and reporting any bugs you may
notice to:

 http://bugs.python.org


Enjoy!

--
Benjamin Peterson
2.7 Release Manager
benjamin at python.org
(on behalf of the entire python-dev team and 2.7's contributors)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Sample code usable Tkinter listbox

2010-03-06 Thread rantingrick
Opps: found a few errors in that last ScrolledListbox class, try this
one...



import Tkinter as tk
from Tkconstants import *

class ScrolledList(tk.Listbox):
def __init__(self, master, **kw):
self.frame = tk.Frame(master)
self.frame.rowconfigure(0, weight=1)
self.frame.columnconfigure(0, weight=1)
self.hbar = tk.Scrollbar(self.frame, orient=HORIZONTAL)
self.block = tk.Frame(self.frame, width=18, height=18)
self.block.grid(row=1, column=1)
self.vbar = tk.Scrollbar(self.frame, orient=VERTICAL)
kw.setdefault('activestyle', 'none')
kw.setdefault('highlightthickness', 0)
kw.setdefault('pack', 0)
if kw.pop('pack') == 1:
self.frame.pack(fill=BOTH, expand=1)
tk.Listbox.__init__(self, self.frame, **kw)
self.grid(row=0, column=0, sticky=N+S+E+W)
self.hbar.configure(command=self.xview)
self.vbar.configure(command=self.yview)
self.config(
yscrollcommand=self.vbar.set,
xscrollcommand=self.hbar.set
)
self.hbar.grid(row=1, column=0, sticky=W+E)
self.vbar.grid(row=0, column=1, sticky=N+S)

self.pack = lambda **kw: self.frame.pack(**kw)
self.grid = lambda **kw: self.frame.grid(**kw)
self.place = lambda **kw: self.frame.place(**kw)
self.pack_config = lambda **kw: self.frame.pack_config(**kw)
self.grid_config = lambda **kw: self.frame.grid_config(**kw)
self.place_config = lambda **kw: self.frame.place_config(**kw)
self.pack_configure = lambda **kw:
self.frame.pack_config(**kw)
self.grid_configure = lambda **kw:
self.frame.grid_config(**kw)
self.place_configure = lambda **kw:
self.frame.place_config(**kw)

def gets(self):
return self.get(0, END)

def sets(self, arg):
self.delete(0, END)
try:
arg = arg.strip('\n').splitlines()
except AttributeError:
pass
if hasattr(arg, '__getitem__'):
for item in arg:
self.insert(END, str(item))
else:
raise TypeError("Scrolledlist.sets() requires a string or
iterable of strings")


if __name__ == '__main__':
root = tk.Tk()
listbox = ScrolledList(root, width=50, height=10, pack=1)
#listbox.sets(1.25)
#listbox.sets('1\n2\n3\n4\n5\n\n\n')
listbox.sets(range(100))
#listbox.grid(row=0, column=0)
root.mainloop()
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Conditional based on whether or not a module is being used

2010-03-06 Thread Pete Emerson
On Mar 6, 2:38 pm, Vinay Sajip  wrote:
> On Mar 5, 9:29 pm, Pete Emerson  wrote:
>
>
>
> > I have written my first module called "logger" that logs to syslog via
> > the syslog module but also allows forloggingto STDOUT in debug mode
> > at multiple levels (to increase verbosity depending on one's need), or
> > both. I've looked at theloggingmodule and while it might suit my
> > needs, it's overkill for me right now (I'm still *very* much a python
> > newbie).
>
> Overkill in what sense? You just need to write a few lines of code to
> be able to use the logging package which comes with Python:
>
> import logging, logging.handlers, sys
> logging.basicConfig(level=logging.DEBUG, stream=sys.stdout)
> logging.getLogger().addHandler(logging.handlers.SysLogHandler())
> # default logs to syslog at (localhost, 514) with facility LOG_USER
> # you can change the default to use e.g. Unix domain sockets and a
> different facility
>
> So you're experienced enough and have time enough to write your own
> logger module, but too much of a newbie to use a module which is part
> of Python's included batteries? If you're writing something like
> logging to learn about it and what the issues are, that's fair enough.
> But I can't see what you mean by overkill, exactly. The three lines
> above (or thereabouts) will, I believe, let you log to syslog and to
> stdout...which is what you say you want to do.
>
> > I want to write other modules, and my thinking is that it makes sense
> > for those modules to use the "logger" module to do thelogging, if and
> > only if the parent using the other modules is also using the logger
> > module.
>
> > In other words, I don't want to force someone to use the "logger"
> > module just so they can use my other modules, even if the "logger"
> > module is installed ... but I also want to take advantage of it if I'm
> > using it.
>
> > Now that I've written that, I'm not sure that makes a whole lot of
> > sense. It seems like I could say, "hey, this person has the 'logger'
> > module available, let's use it!".
>
> > Thoughts?
>
> Well, the logging package is available in Python and ready for use and
> pretty much battle tested, so why not use that? Are you planning to
> use third-party libraries in your Python work, or write everything
> yourself? If you are planning to use third party libraries, how would
> their logging be hooked into your logger module? And if not, is it
> good to have two logging systems in parallel?
>
> Of course as the maintainer of Python's logging package, you'd expect
> me to be biased in favour of it. You maybe shouldn't let that sway
> you ;-)
>
> Regards,
>
> Vinay Sajip

Thanks for your insights, Vinay, and thank you also for writing
packages such as logging. The word 'overkill' was a poor choice on my
part! I should have said, "I don't quite understand the logging module
yet, but I am comfortable with the syslog module's two functions,
openlog and syslog".

I wrote my own logger module *partly* to gain the experience, and
partly to do the following:

1) In debug mode, send what would have gone to syslog to STDOUT or
STDERR
2) In non-debug mode, use /dev/log or localhost:514 depending on what
is set
3) Allow for multiple levels of logging beyond INFO, WARNING, CRIT ...
essentially allow multiple levels of INFO depending on how much detail
is desired.  A high level of messaging when programs are running
poorly is desired, but when programs are running smoothly, I don't
need to send as much to syslog.

I started in with your logging package, but I think I simply got ahead
of myself. I definitely agree that writing my own wrappers around
syslog to do what I want might be a duplication of effort. At this
point I think I'm ready to go back to your logging package and see
what I can do; if you have words of advice regarding 1-3 above, I'd
certainly appreciate it.

Now I'll go to your example above and see what it does. Thank you!

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


python b.python 8 works on XP but not on Vista?

2010-03-06 Thread Isaac Gouy
At the command prompt:

   python b.py 8
works fine on both XP and Vista

   python b.python 8
works on XP (and Linux)

but on Vista

   python b.python 8

ImportError: No module named b

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


async notification handling w/o threads/polling (similiar to kill -hup)?

2010-03-06 Thread News123
Hi,

I'd like to notify python processes asynchronously.
at notification time a callback should be called

The solution should be working on linux and Windows.

I could add a wrapper to switch between a windows / linux implementation
though

If possible I'd like to avoid
- having to poll for an external event
- having to add a thread.
- changing my existing code

I thought about using   signal and os.kill()
However windows does not to have SIGHUP , SIGUSR1 or SIGUSR2.
So I'm not sure, which signal I could use with windows.


Apart from that there's one minor problem with signals
which might speak against using signal
All blocking io calls might be interrupted, which is not desirable in my
case.

Do you have any suggestions for
Linux / WIndows or both?


 example code with signals #
 a blocking io call here reading a named pipe
 would be interrupted
import signal
a = 0
def handler(signum,frame):
global a
a += 1

signal.signal(signal.SIGUSR1,handler)
print "hi"
p = open("namedpipe")
while True:
v = p.read(2)
print "V:",a,len(v)
if len(v) != 2: break

print "var a changed, but read() was interrupted :-("


bye


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


Re: python b.python 8 works on XP but not on Vista?

2010-03-06 Thread Chris Rebert
On Sat, Mar 6, 2010 at 3:53 PM, Isaac Gouy  wrote:
> At the command prompt:
>
>   python b.py 8
> works fine on both XP and Vista
>
>   python b.python 8
> works on XP (and Linux)
>
> but on Vista
>
>   python b.python 8
>
> ImportError: No module named b
>
> ?

Code please. Also, .python is not a standard extension for Python
files, so why are you using it anyway?

Cheers,
Chris
--
http://blog.rebertia.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: async notification handling w/o threads/polling (similiar to kill -hup)?

2010-03-06 Thread News123
News123 wrote:
> Hi,
> 
> I'd like to notify python processes asynchronously.
> at notification time a callback should be called
> 
> The solution should be working on linux and Windows.
> 
> I could add a wrapper to switch between a windows / linux implementation
> though
> 
> If possible I'd like to avoid
> - having to poll for an external event
> - having to add a thread.
Well having a blocking thread would be fine though. what I'd really want
to avoid is any polling.
> - changing my existing code
> 
> I thought about using   signal and os.kill()
> However windows does not to have SIGHUP , SIGUSR1 or SIGUSR2.
> So I'm not sure, which signal I could use with windows.
> 
> 
> Apart from that there's one minor problem with signals
> which might speak against using signal
> All blocking io calls might be interrupted, which is not desirable in my
> case.
> 
> Do you have any suggestions for
> Linux / WIndows or both?
> 
> 
>  example code with signals #
>  a blocking io call here reading a named pipe
>  would be interrupted
> import signal
> a = 0
> def handler(signum,frame):
> global a
> a += 1
> 
> signal.signal(signal.SIGUSR1,handler)
> print "hi"
> p = open("namedpipe")
> while True:
> v = p.read(2)
> print "V:",a,len(v)
> if len(v) != 2: break
> 
> print "var a changed, but read() was interrupted :-("
> 
> 
> bye
> 
> 
> N
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python b.python 8 works on XP but not on Vista?

2010-03-06 Thread Isaac Gouy
On Mar 6, 4:02 pm, Chris Rebert  wrote:
> On Sat, Mar 6, 2010 at 3:53 PM, Isaac Gouy  wrote:
> > At the command prompt:
>
> >   python b.py 8
> > works fine on both XP and Vista
>
> >   python b.python 8
> > works on XP (and Linux)
>
> > but on Vista
>
> >   python b.python 8
>
> > ImportError: No module named b
>
> > ?
>
> Code please.


It's the same code in both cases, I simply renamed "b.python" as
"b.py" as a test.


> Also, .python is not a standard extension for Python
> files, so why are you using it anyway?

Because it's useful for what I'm doing.

Given python 2.6.4 has no problem with a non-standard extension on MS
XP and Linux - why does python 2.6.4 have this problem with a non-
standard extension on MS Vista?


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


Re: indentation error

2010-03-06 Thread Tim Roberts
asit  wrote:
>
>According to me, indentation is ok. but the python interpreter gives
>an indentation error
>
>[asit ~/py] $ python search.py
>  File "search.py", line 7
>findResults = string.split(commandOutput, "\n")
>  ^
>IndentationError: unindent does not match any outer indentation level

The most likely cause is mixing spaces with tabs.
-- 
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python b.python 8 works on XP but not on Vista?

2010-03-06 Thread Chris Rebert
On Sat, Mar 6, 2010 at 4:42 PM, Isaac Gouy  wrote:
> On Mar 6, 4:02 pm, Chris Rebert  wrote:
>> On Sat, Mar 6, 2010 at 3:53 PM, Isaac Gouy  wrote:
>> > At the command prompt:
>>
>> >   python b.py 8
>> > works fine on both XP and Vista
>>
>> >   python b.python 8
>> > works on XP (and Linux)
>>
>> > but on Vista
>>
>> >   python b.python 8
>>
>> > ImportError: No module named b
>>
>> > ?
>>
>> Code please.
>
>
> It's the same code in both cases, I simply renamed "b.python" as
> "b.py" as a test.

The code in b.py matters. I /suspect/ it's importing itself somehow
(probably indirectly), and Python doesn't look for ".python" files
when importing, so it fails with an ImportError. But since you haven't
shown the code, I can only guess.

For that matter, the full exception Traceback would be more helpful
than the code; please include it as well.

Cheers,
Chris
--
http://blog.rebertia.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python b.python 8 works on XP but not on Vista?

2010-03-06 Thread Isaac Gouy
On Mar 6, 4:53 pm, Chris Rebert  wrote:
> On Sat, Mar 6, 2010 at 4:42 PM, Isaac Gouy  wrote:
> > On Mar 6, 4:02 pm, Chris Rebert  wrote:
> >> On Sat, Mar 6, 2010 at 3:53 PM, Isaac Gouy  wrote:
> >> > At the command prompt:
>
> >> >   python b.py 8
> >> > works fine on both XP and Vista
>
> >> >   python b.python 8
> >> > works on XP (and Linux)
>
> >> > but on Vista
>
> >> >   python b.python 8
>
> >> > ImportError: No module named b
>
> >> > ?
>
> >> Code please.
>
> > It's the same code in both cases, I simply renamed "b.python" as
> > "b.py" as a test.
>
> The code in b.py matters. I /suspect/ it's importing itself somehow
> (probably indirectly), and Python doesn't look for ".python" files
> when importing, so it fails with an ImportError. But since you haven't
> shown the code, I can only guess.

Yes the code in b.py matters.

Why it matters is that there was another difference between XP and
Vista - the XP machine was single core but the Vista machine was multi
core - and the code behaves differently in each case.

Thanks.

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


Re: python b.python 8 works on XP but not on Vista?

2010-03-06 Thread sstein...@gmail.com

On Mar 6, 2010, at 8:23 PM, Isaac Gouy wrote:

> On Mar 6, 4:53 pm, Chris Rebert  wrote:
>> On Sat, Mar 6, 2010 at 4:42 PM, Isaac Gouy  wrote:
>>> On Mar 6, 4:02 pm, Chris Rebert  wrote:
 On Sat, Mar 6, 2010 at 3:53 PM, Isaac Gouy  wrote:
> At the command prompt:
>> 
>   python b.py 8
> works fine on both XP and Vista
>> 
>   python b.python 8
> works on XP (and Linux)
>> 
> but on Vista
>> 
>   python b.python 8
>> 
> ImportError: No module named b
>> 
> ?
>> 
 Code please.
>> 
>>> It's the same code in both cases, I simply renamed "b.python" as
>>> "b.py" as a test.
>> 
>> The code in b.py matters. I /suspect/ it's importing itself somehow
>> (probably indirectly), and Python doesn't look for ".python" files
>> when importing, so it fails with an ImportError. But since you haven't
>> shown the code, I can only guess.
> 
> Yes the code in b.py matters.
> 
> Why it matters is that there was another difference between XP and
> Vista - the XP machine was single core but the Vista machine was multi
> core - and the code behaves differently in each case.

Yes, and the XP machine's case was blue, therefore case color is important, too.

S

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


Re: python b.python 8 works on XP but not on Vista?

2010-03-06 Thread Steven D'Aprano
On Sat, 06 Mar 2010 21:10:02 -0500, sstein...@gmail.com wrote:

> On Mar 6, 2010, at 8:23 PM, Isaac Gouy wrote:
> 
>> On Mar 6, 4:53 pm, Chris Rebert  wrote:
>>> On Sat, Mar 6, 2010 at 4:42 PM, Isaac Gouy  wrote:
 On Mar 6, 4:02 pm, Chris Rebert  wrote:
> On Sat, Mar 6, 2010 at 3:53 PM, Isaac Gouy  wrote:
>> At the command prompt:
>>> 
>>   python b.py 8
>> works fine on both XP and Vista
>>> 
>>   python b.python 8
>> works on XP (and Linux)
>>> 
>> but on Vista
>>> 
>>   python b.python 8
>>> 
>> ImportError: No module named b
>>> 
>> ?
>>> 
> Code please.
>>> 
 It's the same code in both cases, I simply renamed "b.python" as
 "b.py" as a test.
>>> 
>>> The code in b.py matters. I /suspect/ it's importing itself somehow
>>> (probably indirectly), and Python doesn't look for ".python" files
>>> when importing, so it fails with an ImportError. But since you haven't
>>> shown the code, I can only guess.
>> 
>> Yes the code in b.py matters.
>> 
>> Why it matters is that there was another difference between XP and
>> Vista - the XP machine was single core but the Vista machine was multi
>> core - and the code behaves differently in each case.
> 
> Yes, and the XP machine's case was blue, therefore case color is
> important, too.


Don't forget that the XP machine was on the left hand side of the desk, 
and the Vista machine on the right. I suspect Isaac needs to physically 
move the Vista machine to the left side, and it will work perfectly.

Either that, or stop pissing around and show us the actual stack trace so 
we can actually help. Isaac, stop *guessing* what the problem is.

If you have to guess, try to make your guesses realistic. It's not likely 
anything to do with the CPU. If anything, Python's search path is 
different on your Vista and XP machines.




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


Re: python b.python 8 works on XP but not on Vista?

2010-03-06 Thread Isaac Gouy
On Mar 6, 6:50 pm, Steven D'Aprano  wrote:
> On Sat, 06 Mar 2010 21:10:02 -0500, sstein...@gmail.com wrote:
> > On Mar 6, 2010, at 8:23 PM, Isaac Gouy wrote:
>
> >> On Mar 6, 4:53 pm, Chris Rebert  wrote:
> >>> On Sat, Mar 6, 2010 at 4:42 PM, Isaac Gouy  wrote:
>  On Mar 6, 4:02 pm, Chris Rebert  wrote:
> > On Sat, Mar 6, 2010 at 3:53 PM, Isaac Gouy  wrote:
> >> At the command prompt:
>
> >>   python b.py 8
> >> works fine on both XP and Vista
>
> >>   python b.python 8
> >> works on XP (and Linux)
>
> >> but on Vista
>
> >>   python b.python 8
>
> >> ImportError: No module named b
>
> >> ?
>
> > Code please.
>
>  It's the same code in both cases, I simply renamed "b.python" as
>  "b.py" as a test.
>
> >>> The code in b.py matters. I /suspect/ it's importing itself somehow
> >>> (probably indirectly), and Python doesn't look for ".python" files
> >>> when importing, so it fails with an ImportError. But since you haven't
> >>> shown the code, I can only guess.
>
> >> Yes the code in b.py matters.
>
> >> Why it matters is that there was another difference between XP and
> >> Vista - the XP machine was single core but the Vista machine was multi
> >> core - and the code behaves differently in each case.
>
> > Yes, and the XP machine's case was blue, therefore case color is
> > important, too.
>
> Don't forget that the XP machine was on the left hand side of the desk,
> and the Vista machine on the right. I suspect Isaac needs to physically
> move the Vista machine to the left side, and it will work perfectly.
>
> Either that, or stop pissing around and show us the actual stack trace so
> we can actually help. Isaac, stop *guessing* what the problem is.
>
> If you have to guess, try to make your guesses realistic. It's not likely
> anything to do with the CPU. If anything, Python's search path is
> different on your Vista and XP machines.
>
> --
> Steven


That was "Thanks." as in problem solved.

When the code switches on multiprocessing.cpu_count() - single core vs
multicore matters.
-- 
http://mail.python.org/mailman/listinfo/python-list


yappi v0.42 released

2010-03-06 Thread k3xji
Hi all,

yappi(yet another python profiler with multithreading support)
released.

See:
http://code.google.com/p/yappi/

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


Re: python b.python 8 works on XP but not on Vista?

2010-03-06 Thread Steven D'Aprano
On Sat, 06 Mar 2010 19:04:56 -0800, Isaac Gouy wrote:

> That was "Thanks." as in problem solved.
> 
> When the code switches on multiprocessing.cpu_count() - single core vs
> multicore matters.

I'm glad you solved your problem. Out of curiosity, what was the fault? 
Not the condition that leads to the fault, but the actual fault?

My guess is that it was a difference in sys.path, leading to the b module 
not being found. Am I close?


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


Asynchronous HTTP client

2010-03-06 Thread Ping
Hi,

I'm trying to find a way to create an asynchronous HTTP client so I
can get responses from web servers in a way like

  async_http_open('http://example.com/', callback_func)
  # immediately continues, and callback_func is called with response
as arg when it is ready

It seems twisted can do it, but I hesitate to bring in such a big
package as a dependency because my client should be light. Asyncore
and asynchat are lighter but they don't speak HTTP. The asynchttp
project on sourceforge is a fusion between asynchat and httplib, but
it hasn't been updated since 2001 and is seriously out of sync with
httplib.

I'd appreciate it if anyone can shed some lights on this.

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