$Wholesale Sports Shoes Clear Air Force One AAA++quality

2010-05-30 Thread yan
$Wholesale Sports Shoes Clear Air Force One AAA++quality
please kindly visite our website: http://www.8000trade.com
supply sports shoes. The brand Sports shoes basketball shoes, Boot,
walling shoes, Athletic shoes, Jogging shoes, running shoes, leather
shoes, football, shoe sports shoe Footwear Sneaker, Shox Max Rift T-
shirts, womens t-shirts, Clothing womens clothing, wear hats Caps
Jersey jeans Sock Jacks, Watches, wallet, handbags, and Jeans Lady
Clothing and so on. Please contact us by email to get more
information.

our price $33shoes,$15tshirt,15sunglasess, $13cap,$33jean,$35bag
please kindly visite our website: http://www.8000trade.com
-- 
http://mail.python.org/mailman/listinfo/python-list


New learner of Python--any suggestion on studying it?

2012-03-18 Thread yan xianming
Hello all,

I'm a new learning of Python.



Can someone give me some suggestion about it?

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


Re: Fetching data from a HTML file

2012-03-23 Thread Simon Yan
On Fri, Mar 23, 2012 at 9:52 PM, Sangeet  wrote:

> Hi,
>
> I've got to fetch data from the snippet below and have been trying to
> match the digits in this to specifically to specific groups. But I can't
> seem to figure how to go about stripping the tags! :(
>
> Sum class="green">24511 align='center'>02561.496
> [min]
> 
>
> Actually, I'm working on ROBOT Framework, and haven't been able to figure
> out how to read data from HTML tables. Reading from the source, is the best
> (read rudimentary) way I could come up with. Any suggestions are welcome!
>

Sangeet,

I think Python comes with its own HTML parser. Can you have a look at this
http://docs.python.org/library/htmlparser.html and see if it helps?


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



-- 
Regards,
YeeYaa (Simon Yan)

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


import newer

2011-03-19 Thread xinyou yan
I begin to study with  <>

I met a problem with import.

first
I creat a  file  hello.py

then in fedora /14
I type python to  the interpreter

>>> import hello
Traceback (most recent call last):
  File "", line 1, in 
ImportError: No module named hello

What should i do now.
The  current path is not  added  defaultly ?
-- 
http://mail.python.org/mailman/listinfo/python-list


Diagnose a segfault in ipython/readline

2014-03-05 Thread Felix Yan
Hi,

I'm getting a reproducible crash in ipython, but not sure what upstream it 
should belong to.

The crash happens with python 2.7.6/3.3.4, with readline 6.3.

Steps to reproduce:

- run ipython
- input some random char sequence that you never inputed (like 
"ae3r0gka03k0k23"), don't press Enter
- press "Up", followed by any key

Backtrace pasted here: https://paste.xinu.at/cg7/
Downstream bug report on Arch Linux: https://bugs.archlinux.org/task/39144

Any help would be really appreciated!

Regards,
Felix Yan

signature.asc
Description: This is a digitally signed message part.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Diagnose a segfault in ipython/readline

2014-03-05 Thread Felix Yan
On Wednesday, March 05, 2014 20:15:31 Ned Deily wrote:
> The current
> assumption is that Python 2.7.6+, 3.3.5, and 3.4.0 have no problems with
> readline 6.3.

Thank you.

I just gave a try to 3.4.0b2 with readline 6.3, and still get the same 
segfault. Not sure the version is new enough though.

Also we reported the problem on readline mailing list first, so if they end up 
thinking there's something that python need to fix, I'll open a bug on the 
Python bug tracker.

Thanks again!

Regards,
Felix Yan

signature.asc
Description: This is a digitally signed message part.
-- 
https://mail.python.org/mailman/listinfo/python-list


Thread._stop() behavior changed in Python 3.4

2014-03-17 Thread Felix Yan
Hi list,

I noticed a behavior change on Thread._stop() with Python 3.4.

I know the method is an undocumented "feature" itself, but some projects are 
using it, and now they fail.

A minimized snippet to reproduce:

#!/usr/bin/python
import threading
def stale():
import time
time.sleep(1000)
t = threading.Thread(target=stale)
t.start()
t._stop()

This works correctly with Python 3.3, the program exits immediately after 
t._stop() called, and no exception was raised.

But with Python 3.4, an AssertionError was raised:

Traceback (most recent call last):
  File "test.py", line 8, in 
t._stop()
  File "/usr/lib/python3.4/threading.py", line 990, in _stop
assert not lock.locked()
AssertionError

And the program still waits on the sleep().

I know trying to forcefully stop a thread is not really a good practice, but I 
still wonder if there's an easy way to get broken programs to work again, just 
in the way they currently are?

Downstream bug reports, for reference:

http://youtrack.jetbrains.com/issue/PY-12317
https://github.com/paramiko/paramiko/issues/286

Regards,
Felix Yan

signature.asc
Description: This is a digitally signed message part.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Thread._stop() behavior changed in Python 3.4

2014-03-17 Thread Felix Yan
On Monday, March 17, 2014 17:33:09 Antoine Pitrou wrote:
> Hi,
> 
> Felix Yan  gmail.com> writes:
> > A minimized snippet to reproduce:
> > 
> > #!/usr/bin/python
> > import threading
> > 
> > def stale():
> > import time
> > time.sleep(1000)
> > 
> > t = threading.Thread(target=stale)
> > t.start()
> > t._stop()
> > 
> > This works correctly with Python 3.3, the program exits immediately after
> > t._stop() called, and no exception was raised.
> 
> Basically what you are doing is abusing a private method because you want
> to make the thread daemonic after it was started (a daemonic thread is
> not waited for at interpreter exit). Please do note one thing: the _stop()
> method does *not* actually stop the thread; it just marks it stopped, but
> the underlying OS thread continues to run (and may indeed continue to
> execute Python code until the interpreter exits).
> 
> So the obvious "solution" here is to mark the thread daemonic before
> starting it.
> 
> A possible related improvement would be to relax the contraints on
> Thread.daemon to allow setting the flag on a running thread?
> 
> That said, daemon threads (or abuse of the _stop() method as you did) can
> lead to instabilities and oddities as some code will continue executing
> while the interpreter starts shutting down. This has been improved but
> perhaps not totally solved in recent interpreter versions. A fully correct
> solution would involve gracefully telling the thread to shut down, via a
> boolean flag, an Event, a file descriptor or any other means.
> 
> (if you are interested in this, please open a new issue at
> http://bugs.python.org)
> 
> Regards
> 
> Antoine.

Thanks for the detailed explanation!

Actually I didn't used _stop() myself either, but noticed the problem when 
trying to build paramiko against python 3.4.

Thanks especially for the tip that the threads may be still running - actually 
I didn't even think about this part!

For now I just skipped the test suites for paramiko to get the packaging done 
(since the test suites themselves are passed without a problem, just the test 
script made something wrong). I'll try to follow up the issue for paramiko :)

Regards,
Felix Yan

signature.asc
Description: This is a digitally signed message part.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Thread._stop() behavior changed in Python 3.4

2014-03-17 Thread Felix Yan
On Tuesday, March 18, 2014 05:08:20 Chris Angelico wrote:
> I've posted comments on both the issues you linked to. My guess based
> on a cursory look at paramiko is that it's a test suite watchdog,
> which would be much better implemented with a subprocess; I may be
> wrong, though. In any case, if it's just a tests problem, you should
> theoretically be able to ignore it.
> 
> ChrisA

I was just trying to comment and see yours... Thanks a lot! :D

Regards,
Felix Yan

signature.asc
Description: This is a digitally signed message part.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Issuing a sqilte query, picking a random result, and copying to the system clipboard

2015-06-23 Thread Felix Yan
On 06/22/2015 07:51 PM, Tim Chase wrote:
> On Win32, you'd need the Win32 add-on libraries to shove things onto
> the clipboard, while under X, you'd need other facilities (either
> using Tkinter or piping to something like xclip(1)), and yet another
> way of doing things on MacOS.

Or you may want an existing library for all these. For example, pyperclip:

>>> import pyperclip
>>> pyperclip.copy('The text to be copied to the clipboard.')

FYI: https://pypi.python.org/pypi/pyperclip

-- 
Regards,
Felix Yan



signature.asc
Description: OpenPGP digital signature
-- 
https://mail.python.org/mailman/listinfo/python-list


root[:]=[root,root]

2011-12-16 Thread YAN HUA
Hi,all. Could anybody tell how this code works?
>>> root = [None, None]
>>> root[:] = [root, root]
>>> root
[[...], [...]]
>>> root[0]
[[...], [...]]
>>> root[0][0][1][1][0][0][0][1][1]
[[...], [...]]
>>>

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


how to move cursor in Interactive Interpreter

2007-08-13 Thread yan . python
i  have a question.
when i run Interactive Interpreter in linux command promt,how can i
move the cursor.
for example,when i enter a string,i often enter the quotation mark ""
first,and the move the cursor inside the mark to enter the string,in
windows,it is ok.but when i do that in linux,pressing the "left" key
will just print "^[[D" in the screen ,but not what i want.
so , how can i move the cursor Interactive Interpreter in linux?
 i've googled and find nothing useful.who i tell me what to do?

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

Re: how to move cursor in Interactive Interpreter

2007-08-14 Thread yan . python
On 8 14 ,   2 44 , Peter Otten <[EMAIL PROTECTED]> wrote:
>  [EMAIL PROTECTED] wrote:
> > i  have a question.
> > when i run Interactive Interpreter in linux command promt,how can i
> > move the cursor.
> > for example,when i enter a string,i often enter the quotation mark ""
> > first,and the move the cursor inside the mark to enter the string,in
> > windows,it is ok.but when i do that in linux,pressing the "left" key
> > will just print "^[[D" in the screen ,but not what i want.
> > so , how can i move the cursor Interactive Interpreter in linux?
> >  i've googled and find nothing useful.who i tell me what to do?
>
> Python uses GNU readline for cursor movements. The Python version that ships
> with your distribution should work out of the box. If you compile Python
> yourself make sure that the development package (not just the binary) is
> installed. For Suse this is readline-devel.
>
> Peter

thanks for your reply
I thought maybe i just didn't install readline correctly,so i deleted
python and tried to re-compile the source code(I downloaded the .bz2
version).This time ,I found in the "./Modules/Setup" the description
for "readline":

# GNU readline. Unlike previous Python incarnations, GNU readline is
# now incorporated in an optional module, configured in the Setup
file
# instead of by a configure script switch. You may have to insert a
# -L option pointing to the directory where libreadline.* lives,
# and you may have to change -ltermcap to -ltermlib or perhaps remove
# it, depending on your system -- see the GNU readline instructions.
# It's okay for this to be a shared library, too.

#readline readline.c -lreadline -ltermcap

dont know exactly what to do,I just delete the "#" mark in the line
"#readline readline.c -lreadline -ltermcap " , then tried to
"configure","make",but errors of readline occor here.
what am i supposed to do to install the module GNU readline correctly
then?
thanks

by the way,my linux is Mandriva 10

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


Re: how to move cursor in Interactive Interpreter

2007-08-14 Thread yan . python
On 8 14 ,   9 20 , Peter Otten <[EMAIL PROTECTED]> wrote:
>  [EMAIL PROTECTED] wrote:
> > what am i supposed to do to install the module GNU readline correctly
> > then?
> > by the way,my linux is Mandriva 10
>
> Use the package manager of your distribution to install the readline
> development package -- after some struggle with Mandriva's website I came
> to suppose that it's libreadline5-devel for you:
>
> urpmi libreadline5-devel.rpm
>
> After you have successfully installed that package unpack the python archive
> into a fresh directory and do the configure/make/install dance. No manual
> changes should be necessary.
>
> Peter



i've re-install python as you said,and it works now
i really appreciate your help
thanks!

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


any problem with py's RC?

2007-08-24 Thread Yan Zhu
hi all,
Here is 3 PYs, we found there is a big memory wasting, specially the program
c.py, we found the memory will increase very soon.
any body knows why? any RC's problem? thanks

-- 
eSX
class a():
def __init__(self):
fp = open("a_file_lager_1M","rb")
self.ll = fp.read()
fp.close()
self.h = b(self.aaa)
def aaa(self):
pass

class b:
def __init__(self,bbb):
self.a = bbb  #remove the "self.", the memory use will be very 
low!
pass

def c():
k=a()

while True:
c()


import haha
import time

def c():
b=haha.Client(["127.0.0.1"])
while True:
   # time.sleep(1)
c()


#!/usr/bin/env python

from threading import local


class Client(local):
def __init__(self, servers, debug=0):
self.k = [_Host(s, self.debuglog) for s in servers]

def debuglog(self, str):
pass
class _Host:

def __init__(self, host, debugfunc=None):
self.debuglog = debugfunc  #a -> b  b->a, make the memory be huge!
pass


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

Re: problem with regex, how to conclude more than one character

2008-11-06 Thread Charles Yan
Really thanks for quickly reply Chris!
Actually I tried BeautifulSoup and it's great.
But I'm not very familiar with it and it need more codes to parse the html
and get the right text.
I think regexp is more convenient if there is a way to filter out the list
just in one line:)
I did this all the way but stopped here...


On 11/7/08, Chris Rebert <[EMAIL PROTECTED]> wrote:
>
> On Thu, Nov 6, 2008 at 11:06 PM,  <[EMAIL PROTECTED]> wrote:
> > I always have no idea about how to express "conclude the entire word"
> > with regexp,  while using python, I encountered this problem again...
> >
> > for example, if I want to match the "string" in "test a string",
> > re.findall(r"[^a]* (\w+)","test a string") will work, but what if
> > there is not "a" but "an"(test a string)? the [^an] will failed
> > because it will stop at the first character "a".
> >
> > I guess people not always use this kind of way to filter words?
> > Here comes the real problem I encountered:
> > I want to filter the text both in "" block and the ""'s
> > title attribute
>
> Is there any particularly good reason why you're using regexps for
> this rather than, say, an actual (X)HTML parser?
>
> Cheers,
> Chris
> --
> Follow the path of the Iguana...
> http://rebertia.com
>
> > ## code #
> > import re
> > content=''' > valign="middle">LA11/10/2008 > valign="middle">1340/1430PF1/5 > valign="middle"> > class="MouseCursor">Understand > valign="middle">CharismaBooked > valign="middle">'''
> >
> > re.findall(r'''([^<]+) > valign="middle">([^<]+)([^<]+) > valign="middle">([^<]+) > title="([^"]*)"''',content)
> >
> >  code end 
> > As you saw above,
> > I get the results with "LA,11/10/2008,1340/1430,PF1/5,Understanding
> > the stock market"
> > there are two "" block but I can just get the "title" attribute
> > of the first "" using regexp.
> > for the second, which should be "Charisma" I need to use some kind of
> > [^]* to match "class="MouseCursor">Understand",
> > then I can continue match the second "" block.
> >
> > Maybe I didn't describe this clearly, then feel free to tell me:)
> > thanks for any further reply!
> > --
> > http://mail.python.org/mailman/listinfo/python-list
> >
>
--
http://mail.python.org/mailman/listinfo/python-list


Hi everyone, I get a problem when using binhex module

2009-08-20 Thread Yan Jian
Below is what I copy from the Internet:

import binhex
import sys

infile = "in.txt"

binhex.binhex(infile, sys.stdout)

Every time I try to run this script, I get a message saying

Traceback (most recent call last):
  File "D:\eclipse_workspace\encode\src\binhex.sample.py", line 6, in

import binhex
  File "C:\Python25\lib\binhex.py", line 12, in 
# easy interface should work "as expected" on any platform.
TypeError: 'module' object is not callable

Does anyone encounter similar situation. Thank you for your help?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how to change current working directory while using pdb within emacs

2007-11-26 Thread du yan ning
On Nov 21, 1:28 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote:
> duyanningwrote:
> > I have written a pyhton script that will process data file in current
> > working directory.
> > My script is in an different directory to data file.
> > When I debug this script using pdb within emacs, emacs will change the
> > current working directory to the directory which include the script,
> > so my script cannot find the data file.
>
> > I think this is the problem of emacs because when I start pdb from
> > console directly, it will not change current working directory to the
> > one of script being debugged.
>
> Just issue
>
> import os
> os.chdir('whatever')
>
> inside the pdb-session. Unfortunate, but should work.
>
> Diez

thank you! my friend.
-- 
http://mail.python.org/mailman/listinfo/python-list


Unable to decode file written by C++ wostringstream

2010-12-23 Thread Yan Cheng CHEOK
Currently, I have the following text file 
(https://sites.google.com/site/yanchengcheok/Home/TEST.TXT?attredirects=0&d=1) 
written by C++ wostringstream.

What I want to do it, I want to write a python script which accept user browser 
request, and then send over the entire file for user to download. The 
downloaded file, should be exactly same as the original text file inside server 
itself.

The code is written as follow :

import cgi

print "Content-Type: text/plain"
print "Content-Disposition: attachment; filename=TEST.txt"
print

filename = "C:\\TEST.TXT"
f = open(filename, 'r')
for line in f:
print line

However, when I open up the downloaded file, the file is all having weird 
characters. I try to use rb flag, it doesn't either.

Is there anything I had missed out? What I wish is, the file (TEST.TXT) 
downloaded by the client by making query to the above script, will be exactly 
same as the one in server.

I also try to specific the encoding explicitly.

import cgi

print "Content-Type: text/plain; charset=UTF-16"
print "Content-Disposition: attachment; filename=TEST.txt"
print

filename = "C:\\TEST.TXT"
f = open(filename, 'r')
for line in f:
print line.encode('utf-16')

It doesn't work either. Here is the screen shoot for original text file 
(http://i.imgur.com/S6SjX.png) and file after downloaded from a web browser. 
(http://i.imgur.com/l39Lc.png)

Is there anything I had missed out?

Thanks and Regards
Yan Cheng CHEOK


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