how to set timeout for os.popen

2018-04-15 Thread Ho Yeung Lee
while 1: runner = os.popen("tracert -d www.hello.com") o=runner.read() print(o) runner.close() runner = os.popen("tracert -d www.hello.com") o=runner.read() print(o) runner.close() runner = os.popen("tracert -d www.hello.com") o=runner.read() print(o) runner.close() after running over 1 hour, it

joblib AttributeError: 'module' object has no attribute

2018-04-14 Thread Ho Yeung Lee
Process PoolWorker-1: Traceback (most recent call last): File "C:\Python27\lib\multiprocessing\process.py", line 258, in _bootstrap self.run() File "C:\Python27\lib\multiprocessing\process.py", line 114, in run self._target(*self._args, **self._kwargs) File

Re: why it append one more letter after decode?

2017-10-29 Thread Ho Yeung Lee
i fixed by replace("","\\") On Monday, October 30, 2017 at 11:16:02 AM UTC+8, Igor Korot wrote: > Hi, > > On Sun, Oct 29, 2017 at 10:03 PM, Ho Yeung Lee <jobmatt...@gmail.com> wrote: > > i discover when > > it > > decode("\\&qu

Re: why it append one more letter after decode?

2017-10-29 Thread Ho Yeung Lee
it seems that it read csv file from "\\" to "" On Monday, October 30, 2017 at 11:03:57 AM UTC+8, Ho Yeung Lee wrote: > i discover when > it > decode("\\",1,2) > in interactive console > is [ > > but decode in big project > it see as

Re: why it append one more letter after decode?

2017-10-29 Thread Ho Yeung Lee
i discover when it decode("\\",1,2) in interactive console is [ but decode in big project it see as decode(r"\\",1,2) [[ it double On Monday, October 30, 2017 at 9:51:01 AM UTC+8, Ho Yeung Lee wrote: > if run these function to decode in python interactive console,

ValueError: Error 3 while encrypting in ECB mode

2017-10-29 Thread Ho Yeung Lee
>>> from Crypto.Cipher import AES >>> >>> key = 'mysecretpassword' >>> plaintext = 'Secret Message A' >>> encobj = AES.new(key, AES.MODE_ECB) >>> ciphertext = encobj.encrypt("hello") Traceback (most recent call last): File "", line 1, in File

Re: why it append one more letter after decode?

2017-10-29 Thread Ho Yeung Lee
if run these function to decode in python interactive console, it can decode correct, but when run with a big project, it append a letter Y On Monday, October 30, 2017 at 9:48:36 AM UTC+8, Ho Yeung Lee wrote: > def leftrotate(l, n): > return l[n:] + l[:n] > > def righ

why it append one more letter after decode?

2017-10-29 Thread Ho Yeung Lee
def leftrotate(l, n): return l[n:] + l[:n] def rightrotate(l, n): return l[-n:] + l[:-n] def encode(s, k, kk): l = [ord(i) for i in s] return leftrotate(''.join([chr(i + k) for i in l]), kk) def decode(s, k, kk): l = [ord(i) for i in rightrotate(s, kk)] return

how to create root with treelib?

2017-08-19 Thread Ho Yeung Lee
http://treelib.readthedocs.io/en/latest/examples.html tree = Tree() #create root tree.create_node((0,0), "root") result = [aa[0]] previousnode = (0,0) >>> #create root ... tree.create_node((0,0), "root") Traceback (most recent call last): File "", line 2, in File

Re: why k means do not rectangle the red area drawn by harris corner?

2017-08-14 Thread Ho Yeung Lee
my code can run without error, you can try to download one of face from search keyword "face" and try this script On Tuesday, August 15, 2017 at 4:33:51 AM UTC+8, jlad...@itu.edu wrote: > On Monday, August 14, 2017 at 12:30:21 PM UTC-7, Ho Yeung Lee wrote: > > https://gist.gi

Re: why k means do not rectangle the red area drawn by harris corner?

2017-08-14 Thread Ho Yeung Lee
)+1 colortolocation[eachcolor] = locationsgroup On Tuesday, August 15, 2017 at 4:33:51 AM UTC+8, jlad...@itu.edu wrote: > On Monday, August 14, 2017 at 12:30:21 PM UTC-7, Ho Yeung Lee wrote: > > https://gist.github.com/hoyeunglee/df7e6cb9b76c576b26fd2bb2b26bfe2f > > > >

why k means do not rectangle the red area drawn by harris corner?

2017-08-14 Thread Ho Yeung Lee
https://gist.github.com/hoyeunglee/df7e6cb9b76c576b26fd2bb2b26bfe2f sample image https://drive.google.com/file/d/0Bxs_ao6uuBDUY09qM1JMWS1Ob0k/view?usp=sharing would like to rectangle bound the eye ,mouth corner etc which detected by harris corner but using kmeans can not rectangle the red area

ValueError: operands could not be broadcast together with shapes

2017-08-06 Thread Ho Yeung Lee
def mse(imageA, imageB): err = np.sum((imageA.astype("float") - imageB.astype("float")) ** 2) err /= float(imageA.shape[0] * imageA.shape[1]) return err original = cv2.imread("C:\\Users\\hello\\Documents\\words\\" + xx) later = cv2.imread("C:\\Users\\hello\\Documents\\words\\"+ yy)

Re: how to sort a list of tuples with custom function

2017-08-04 Thread Ho Yeung Lee
On Friday, August 4, 2017 at 10:08:56 PM UTC+8, Ho Yeung Lee wrote: > i had changed to use kmeans > > https://gist.github.com/hoyeunglee/2475391ad554e3d2b2a40ec24ab47940 > > i do not know whether write it correctly > but it seems can cluster to find words in windo

Re: how to group by function if one of the group has relationship with another one in the group?

2017-08-04 Thread Ho Yeung Lee
On Wednesday, August 2, 2017 at 5:25:21 AM UTC+8, Piet van Oostrum wrote: > Ho Yeung Lee <jobmatt...@gmail.com> writes: > > > which function should be used for this problem? > > > I think it is a kind if clustering, or a connectivity problem. There are > special

Re: [OT] Re: how to guess the number of cluster when do not know?

2017-08-04 Thread Ho Yeung Lee
i use number of clusters = 120 https://drive.google.com/file/d/0Bxs_ao6uuBDUZFByNVgzd0Jrdm8/view?usp=sharing seems better, but still has a long distance to be perfect On Friday, August 4, 2017 at 10:09:59 PM UTC+8, Ho Yeung Lee wrote: > actually i am using python's kmeans libr

Re: [OT] Re: how to guess the number of cluster when do not know?

2017-08-04 Thread Ho Yeung Lee
, 2017 at 8:24:54 PM UTC+8, Alain Ketterlin wrote: > Ho Yeung Lee <jobmatt...@gmail.com> writes: > > > i find kmeans has to input number of cluster > [...] > > https://en.wikipedia.org/wiki/Determining_the_number_of_clusters_in_a_data_set > > Completely off-topic

Re: how to sort a list of tuples with custom function

2017-08-04 Thread Ho Yeung Lee
man wrote: > > > On 8/1/2017 2:10 PM, Piet van Oostrum wrote: > >> Ho Yeung Lee <jobmatt...@gmail.com> writes: > >> > >>> def isneighborlocation(lo1, lo2): > >>> if abs(lo1[0] - lo2[0]) < 7 and abs(lo1[1] - lo2[1]) < 7: > >&

how to guess the number of cluster when do not know?

2017-08-04 Thread Ho Yeung Lee
i find kmeans has to input number of cluster but i do not know how many words in photo before recognization in application of robots vision recognition if separate high, will it become letters instead of word? from pylab import plot,show from numpy import vstack,array from numpy.random import

Re: how to sort a list of tuples with custom function

2017-08-03 Thread Ho Yeung Lee
words are splitted, I have already sorted by x[0] and x[1] can it improver to a consecutively a few words "檔案" <- File is succeed but "另存新檔" failed since words are splitted On Thursday, August 3, 2017 at 3:54:13 PM UTC+8, Ho Yeung Lee wrote: > https://

Re: how to sort a list of tuples with custom function

2017-08-03 Thread Ho Yeung Lee
https://gist.github.com/hoyeunglee/3d340ab4e9a3e2b7ad7307322055b550 I updated again how to do better because some words are stored in different files On Thursday, August 3, 2017 at 10:02:01 AM UTC+8, Ho Yeung Lee wrote: > https://gist.github.com/hoyeunglee/f371f66d55f90dda043f7e7fea38f

Re: how to sort a list of tuples with custom function

2017-08-02 Thread Ho Yeung Lee
discover it can not circle all words with red rectangle and only part of words On Wednesday, August 2, 2017 at 3:06:40 PM UTC+8, Peter Otten wrote: > Glenn Linderman wrote: > > > On 8/1/2017 2:10 PM, Piet van Oostrum wrote: > >> Ho Yeung Lee <jobmatt...@gmail.com

Re: how to sort a list of tuples with custom function

2017-08-01 Thread Ho Yeung Lee
how to write this distance function in sort there are the syntax error On Wednesday, August 2, 2017 at 6:03:13 AM UTC+8, Glenn Linderman wrote: > On 8/1/2017 2:10 PM, Piet van Oostrum wrote: > > Ho Yeung Lee <jobmatt...@gmail.com> writes: > > > >> d

Re: how to sort a list of tuples with custom function

2017-08-01 Thread Ho Yeung Lee
olocation[eachcolor] = locationsgroup for kk in colortolocation[(0,0,0)]: if len(colortolocation[(0,0,0)][kk]) > 7: print kk print colortolocation[(0,0,0)][kk] On Wednesday, August 2, 2017 at 3:50:52 AM UTC+8, Ho Yeung Lee wrote: > def isneighborlocation(lo1, lo2): >

how to sort a list of tuples with custom function

2017-08-01 Thread Ho Yeung Lee
def isneighborlocation(lo1, lo2): if abs(lo1[0] - lo2[0]) < 7 and abs(lo1[1] - lo2[1]) < 7: return 1 elif abs(lo1[0] - lo2[0]) == 1 and lo1[1] == lo2[1]: return 1 elif abs(lo1[1] - lo2[1]) == 1 and lo1[0] == lo2[0]: return 1 else: return 0

Re: how to group by function if one of the group has relationship with another one in the group?

2017-07-30 Thread Ho Yeung Lee
which function should be used for this problem? On Saturday, July 29, 2017 at 11:02:30 PM UTC+8, Piet van Oostrum wrote: > Peter Otten <__pete...@web.de> writes: > > > Ho Yeung Lee wrote: > > > >> from itertools import groupby > >> > >> testin

Re: how to group by function if one of the group has relationship with another one in the group?

2017-07-28 Thread Ho Yeung Lee
not know how to use partial and do not know what center is. On Tuesday, July 25, 2017 at 5:00:25 PM UTC+8, Peter Otten wrote: > Ho Yeung Lee wrote: > > > from itertools import groupby > > > > testing1 = [(1,1),(2,3),(2,4),(3,5),(3,6),(4,6)] > > def isneighborloca

Re: how to group by function if one of the group has relationship with another one in the group?

2017-07-28 Thread Ho Yeung Lee
not know how to use partial and do not know what center is. On Wednesday, July 26, 2017 at 2:06:08 PM UTC+8, ast wrote: > "Ho Yeung Lee" <jobmatt...@gmail.com> a écrit dans le message de > news:ef0bd11a-bf55-42a2-b016-d93f3b831...@googlegroups.com... > > f

how to group by function if one of the group has relationship with another one in the group?

2017-07-24 Thread Ho Yeung Lee
from itertools import groupby testing1 = [(1,1),(2,3),(2,4),(3,5),(3,6),(4,6)] def isneighborlocation(lo1, lo2): if abs(lo1[0] - lo2[0]) == 1 or lo1[1] == lo2[1]: return 1 elif abs(lo1[1] - lo2[1]) == 1 or lo1[0] == lo2[0]: return 1 else: return 0 groupda =

Re: how to create this dependency table from ast?

2017-07-02 Thread Ho Yeung Lee
On Sunday, July 2, 2017 at 9:59:48 PM UTC+8, Ho Yeung Lee wrote: > On Sunday, July 2, 2017 at 9:53:50 PM UTC+8, Ho Yeung Lee wrote: > > On Sunday, July 2, 2017 at 9:32:36 PM UTC+8, ad...@python.org wrote: > > > ad...@python.org: > > > > Hi, Ho! > > > &

Re: how to create this dependency table from ast?

2017-07-02 Thread Ho Yeung Lee
On Sunday, July 2, 2017 at 9:53:50 PM UTC+8, Ho Yeung Lee wrote: > On Sunday, July 2, 2017 at 9:32:36 PM UTC+8, ad...@python.org wrote: > > ad...@python.org: > > > Hi, Ho! > > > > > > it is crucial that you dump that fucking Windows of yours and become >

Re: how to create this dependency table from ast?

2017-07-02 Thread Ho Yeung Lee
On Sunday, July 2, 2017 at 9:32:36 PM UTC+8, ad...@python.org wrote: > ad...@python.org: > > Hi, Ho! > > > it is crucial that you dump that fucking Windows of yours and become > real pythonic under Linux ! i do not understand what is difference in result if run in window and linux goal is to

how to create this dependency table from ast?

2017-07-02 Thread Ho Yeung Lee
i find parseprint function not exist in python 2.7 goal is to create a table graph = {'A': ['B', 'C'], 'B': ['C', 'D'], 'C': ['D'], 'D': ['C'], 'E': ['F'], 'F': ['C']} from a = 1 b = 1 c = a + b d = c e = c file =

Is there library to convert AST to DAG tree?

2017-07-01 Thread Ho Yeung Lee
Is there library to convert AST to DAG tree? -- https://mail.python.org/mailman/listinfo/python-list

Re: how to make this situation return this result?

2017-07-01 Thread Ho Yeung Lee
just want to compare tuples like index (0,1), (0,2), (1,2) without duplicate such as (2,0), (1,0) etc On Saturday, July 1, 2017 at 7:00:17 PM UTC+8, Peter Otten wrote: > Ho Yeung Lee wrote: > > > finally i searched dict.values()[index] solved this > > That doesn't look li

Re: how to make this situation return this result?

2017-07-01 Thread Ho Yeung Lee
finally i searched dict.values()[index] solved this On Saturday, July 1, 2017 at 6:00:41 PM UTC+8, Peter Otten wrote: > Ho Yeung Lee wrote: > > > expect result as this first case > > > > ii = 0 > > jj = 0 > > for ii in range(0,3): > > fo

Re: how to make this situation return this result?

2017-07-01 Thread Ho Yeung Lee
jj = jj + 1 ii = ii + 1 On Saturday, July 1, 2017 at 5:05:48 PM UTC+8, Ho Yeung Lee wrote: > sorry for typo, > > = 0 > = 0 > for ii in range(0,3): > for jj in range(0,3): > if < : > print (ii, jj) <- corr

Re: how to make this situation return this result?

2017-07-01 Thread Ho Yeung Lee
sorry for typo, = 0 = 0 for ii in range(0,3): for jj in range(0,3): if < : print (ii, jj) <- correct here = + 1 = + 1 On Saturday, July 1, 2017 at 4:55:59 PM UTC+8, Ho Yeung Lee wrote: > expect result as t

how to make this situation return this result?

2017-07-01 Thread Ho Yeung Lee
expect result as this first case ii = 0 jj = 0 for ii in range(0,3): for jj in range(0,3): if ii < jj: print (ii, jj) but below is different as sometimes the situation is not range(0,3), but it a a list of tuple = 0 = 0 for ii in range(0,3): for jj in

how to add new tuple as key in dictionary?

2017-06-30 Thread Ho Yeung Lee
I find that list can not be key in dictionary then find tuple can be as key but when I add new tuple as key , got error in python 2.7 groupkey = {(0,0): []} groupkey[tuple([0,3])] = groupkey[tuple([0,3])] + [[0,1]] -- https://mail.python.org/mailman/listinfo/python-list

Re: how to get the html content and edit with scapy and see the edited result in browser?

2017-06-21 Thread Ho Yeung Lee
end it and fetch the returning ack. ackdata1=sr1(ip/data1/html1) # Store new sequence number. SeqNr=ackdata1.ack # Generate RST-ACK packet Bye=TCP(sport=80, dport=ValueOfPort, flags="FA", seq=SeqNr, ack=AckNr, options=[('MSS', 1460)]) send(ip/Bye) On Tuesday, June 20, 2017 at 11:36:07 P

how to get the html content and edit with scapy and see the edited result in browser?

2017-06-20 Thread Ho Yeung Lee
pkts = sniff(prn=lambda x:x.sprintf("{IP:%IP.src% -> %IP.dst%\n}{Raw:%Raw.load%\n}"), filter="tcp port 80") for i in range(1,len(pkts)): #if pkts[i][IP].sport == 80: i,pkts[i][TCP].payload i find pkts[10] do not have html source code (8, ) (9, ) (10, ) (11, ) dir(pkts[10][TCP])

how to decrypt encrypted text to a clear text

2017-06-06 Thread Ho Yeung Lee
i use wb to write pubic and private key and succeed to import private, but after decrypt, it return hex number not a clear text is there any more key needed? or do wb influence the result? from Crypto.PublicKey import RSA keypair = RSA.generate(2048) alice_privkey = keypair.exportKey('PEM',

Re: error when import private key in python

2017-06-04 Thread Ho Yeung Lee
lice_pubkey.txt", "r") alice_pubkey=text_file.read() text_file.close() from Crypto.PublicKey import RSA pubkey = RSA.importKey(alice_pubkey) privkey = RSA.importKey(alice_privkey,passphrase="mysecret") encryption_key = privkey.decrypt(alice_masterkey) encryption

Re: error when import private key in python

2017-06-04 Thread Ho Yeung Lee
\xf0\x0e\x0c\xcb\xa8\xb1\xe7}\x90\xd3\xcfs@\xc2m\x1a^\x1b0\xa7\xdd\xcd\xea\x1f\xd5\x08\x13+y"]vu\xe3\x9e\xba\x97\x10\x90S\xea\xae1=r4Yp,\xe3\xa9\xc66H\xa7\x95[M|n\x91\x98\x9c,\xc4\xf5\x7f\x8cJ\x03\xba\x04Z0lV\xe1\xd6d\xeec@\xe1\xa0\xec\x81]\xef5\r\x12\x88\xbe/\xfc\xe01\xaacn,\x8a\xe1\x14\x8a\x

error when import private key in python

2017-06-04 Thread Ho Yeung Lee
#step 1 from Crypto.PublicKey import RSA keypair = RSA.generate(2048) alice_privkey = keypair.exportKey('PEM', 'mysecret', pkcs=1) #alice_privkey = keypair.exportKey() alice_pubkey = keypair.publickey().exportKey() text_file = open("alice_pubkey.txt", "w") text_file.write(alice_pubkey)

Re: how to convert json to csv with python?

2017-06-03 Thread Ho Yeung Lee
line 380, in raw_decode obj, end = self.scan_once(s, idx) ValueError: Expecting property name: line 38 column 1 (char 871) got another error Chris Warrick於 2017年6月3日星期六 UTC+8下午7時20分34秒寫道: > On 3 June 2017 at 13:00, Ho Yeung Lee <davidbenny2...@gmail.com> wrote: > > i use > &

how to convert json to csv with python?

2017-06-03 Thread Ho Yeung Lee
i use https://github.com/evidens/json2csv Error: Traceback (most recent call last): File "json2csv.py", line 148, in loader.load(args.json_file) File "json2csv.py", line 53, in load self.process_each(json.load(json_file)) File "C:\Python27\lib\json\__init__.py", line 291, in load

how to change code in runtime after convert to executable file

2017-05-31 Thread Ho Yeung Lee
if keep module1.py code together with mainmodule1.exe, how to convert to executable file with py2exe in this case? after tried, it can run executable file with source code module1.py but the modified date can not be changed even if content of module1.py changed then i delete the file and change

Re: multiprocessing.Process can not start a thread in py2exe

2017-05-21 Thread Ho Yeung Lee
On Sunday, May 21, 2017 at 2:47:26 PM UTC+8, Ho Yeung Lee wrote: > On Sunday, May 21, 2017 at 2:40:49 PM UTC+8, top...@googlemail.com wrote: > > Did you call freeze_support() function after script start? > > https://docs.python.org/3/library/multiprocessing.html#multiprocessing

Re: multiprocessing.Process can not start a thread in py2exe

2017-05-21 Thread Ho Yeung Lee
On Sunday, May 21, 2017 at 2:40:49 PM UTC+8, top...@googlemail.com wrote: > Did you call freeze_support() function after script start? > https://docs.python.org/3/library/multiprocessing.html#multiprocessing.freeze_support no, i did not call freeze_support() --

AttributeError: 'module' object has no attribute 'urlretrieve' in window subsystem ubuntu bash for tensorflow

2017-05-21 Thread Ho Yeung Lee
i use window subsystem ubuntu and install python 3 and tensorflow then when try deep learning https://www.tensorflow.org/tutorials/wide_and_deep got error when urlretrieve local directory in ubuntu in window tried urllib3 still have error import tempfile import pandas as pd import urllib as

Re: multiprocessing.Process can not start a thread in py2exe

2017-05-21 Thread Ho Yeung Lee
i mean executable file can not run the multiprocessing thread after convert to executable file with py2exe On Sunday, May 21, 2017 at 2:09:04 PM UTC+8, Ho Yeung Lee wrote: > p = multiprocessing.Process(target=helloconnect, args=(host,"",)) > > multiprocessing.Process can

multiprocessing.Process can not start a thread in py2exe

2017-05-21 Thread Ho Yeung Lee
p = multiprocessing.Process(target=helloconnect, args=(host,"",)) multiprocessing.Process can not start a thread in py2exe it can compile and run without error but it can not run function helloconnect -- https://mail.python.org/mailman/listinfo/python-list

Re: 'module' object has no attribute 'wrap_socket' when use ssl

2017-04-15 Thread Ho Yeung Lee
On Saturday, April 15, 2017 at 3:18:58 PM UTC+8, Peter Otten wrote: > Ho Yeung Lee wrote: > > > Python 2.7.6 (default, Jun 22 2015, 18:00:18) > > [GCC 4.8.2] on linux2 > > Type "help", "copyright", "credits" or "license" for more inf

'module' object has no attribute 'wrap_socket' when use ssl

2017-04-15 Thread Ho Yeung Lee
Python 2.7.6 (default, Jun 22 2015, 18:00:18) [GCC 4.8.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import ssl Traceback (most recent call last): File "", line 1, in File "/home/martin/Documents/ssl.py", line 13, in SSLError -- exception raised

how to convert this container back to format build result?

2017-04-10 Thread Ho Yeung Lee
http://construct.readthedocs.io/en/latest/basics.html format.build can build the hex string, but after edit attribute of the format parse result it is a container, how to convert this container back to format build result?

how to group own any one common in the list?

2017-03-28 Thread Ho Yeung Lee
aaa = ["a","ab","c","b","bc"] def similar(aa): similarset = [] for ii in range(0,len(aa)): for jj in range(ii,len(aa)): if ii <> jj: print("("+str(ii)+","+str(jj)+")") if (aa[ii] in aa[jj]) or (aa[jj] in aa[ii]):

Re: why and how to run forever and debug when error in for proc in psutil.process_iter()?

2017-03-26 Thread Ho Yeung Lee
On Sunday, March 26, 2017 at 7:40:20 PM UTC+8, Ho Yeung Lee wrote: > On Sunday, March 26, 2017 at 7:32:12 PM UTC+8, Ho Yeung Lee wrote: > > On Sunday, March 26, 2017 at 10:33:51 AM UTC+8, Deborah Swanson wrote: > > > Someone here can probably help you, but they'll need your Py

Re: why and how to run forever and debug when error in for proc in psutil.process_iter()?

2017-03-26 Thread Ho Yeung Lee
On Sunday, March 26, 2017 at 7:32:12 PM UTC+8, Ho Yeung Lee wrote: > On Sunday, March 26, 2017 at 10:33:51 AM UTC+8, Deborah Swanson wrote: > > Someone here can probably help you, but they'll need your Python > > version, operating system, and full traceback. They get tired o

Re: why and how to run forever and debug when error in for proc in psutil.process_iter()?

2017-03-26 Thread Ho Yeung Lee
what went wrong and > when (after which statements). > > > Ho Yeung Lee wrote, on Saturday, March 25, 2017 1:38 AM > > > > expect below to run forever and keep running a fixed number > > of thread in python > > > > would like to kill tasks when process connect i

should i kill these two process with python?

2017-03-25 Thread Ho Yeung Lee
TCP127.0.0.1:1663 127.0.0.1:28091ESTABLISHED 9900 TCP127.0.0.1:28091127.0.0.1:1663 ESTABLISHED 9532 above two process connect to itself, named ismagent and updateui.exe are they the malware software? TCP127.0.0.1:1663

why and how to run forever and debug when error in for proc in psutil.process_iter()?

2017-03-25 Thread Ho Yeung Lee
expect below to run forever and keep running a fixed number of thread in python would like to kill tasks when process connect internet except chrome and explorer.exe i do this because MalwareBytes can not disconnect these existing trojan when my notebook connect internet after run a few

Re: how to embed non-tkinter VLC player into grid of tkinter with python?

2017-03-15 Thread Ho Yeung Lee
toweb.mp4" -into %d -geometry 100x200 -sb &' % wid) root.mainloop() On Thursday, March 16, 2017 at 1:16:41 PM UTC+8, Ho Yeung Lee wrote: > martin@ubuntu:~/Downloads/python-vlc/examples$ xdg-screensaver: Window > 0x0900 does not exist > > error when run after inherit

Re: how to embed non-tkinter VLC player into grid of tkinter with python?

2017-03-15 Thread Ho Yeung Lee
uot;tkinter vlc").grid(row=r,column=c) #os.system('xterm -into %d -geometry 40x20 -sb &' % wid) #os.system('vlc --no-fullscreen "file:///home/martin/Downloads/autoweb.mp4" -into %d -geometry 100x200 -sb &' % wid) root.mainloop() On Thursday, March 16, 2017 at

how to embed non-tkinter VLC player into grid of tkinter with python?

2017-03-15 Thread Ho Yeung Lee
we have many TV that would like to be monitored, how to embed non-tkinter VLC player into grid of tkinter with python? below code can embeded xterm but not for VLC player import vlc from Tkinter import * import os root = Tk() for r in range(2): for c in range(1): termf =

dictionary of pickle error when get it in multiprocessing and has name error

2017-02-26 Thread Ho Yeung Lee
before cloususerlogin Unexpected error: after map pool ... passwordlist = pickle.load( open( str(currentworkingdirectory) + "\\decryptedsecret.p", "rb" ) ) def processInput(host): try: decrypt_file(sys.argv[1], str(currentworkingdirectory) + "\\encryptedsecret.p",

Is "two different input map to one unique target called nonlinear case " or "one unique input map to two different target called nonlinear case"? Which learning method can train these two cases or no

2017-01-19 Thread Ho Yeung Lee
Is "two different input map to one unique target called nonlinear case " or "one unique input map to two different target called nonlinear case"? Which learning method can train these two cases or no method to train one of case? -- https://mail.python.org/mailman/listinfo/python-list

Must target be only one bit one such as 0001,0010,0100,1000 In supervised neural learning f(w*p+b) with perceptron rule w = w + e for linear case?

2017-01-19 Thread Ho Yeung Lee
Must target be only one bit one such as 0001,0010,0100,1000 In supervised neural learning f(w*p+b) with perceptron rule w = w + e for linear case? with neural network design does it means that can not use two or more one as target such as 0011,0110,1100,1010, 0111,1110,1101, etc when training

how to override the solver function in sympy?

2016-12-03 Thread Ho Yeung Lee
how to override the solver function in sympy? -- https://mail.python.org/mailman/listinfo/python-list

Re: compile error when using override

2016-12-02 Thread Ho Yeung Lee
y, December 2, 2016 at 1:02:19 PM UTC+8, Steve D'Aprano wrote: > On Fri, 2 Dec 2016 01:35 pm, Ho Yeung Lee wrote: > > > from __future__ import division > > import ast > > from sympy import * > > x, y, z, t = symbols('x y z t') > > k, m, n = symbols('k m n', in

Re: compile error when using override

2016-12-01 Thread Ho Yeung Lee
cember 1, 2016 at 7:19:58 PM UTC+8, Steve D'Aprano wrote: > On Thu, 1 Dec 2016 05:26 pm, Ho Yeung Lee wrote: > > > import ast > > from __future__ import division > > That's not actually your code. That will be a SyntaxError. > > Except in the interactive interpreter,

compile error when using override

2016-11-30 Thread Ho Yeung Lee
import ast from __future__ import division from sympy import * x, y, z, t = symbols('x y z t') k, m, n = symbols('k m n', integer=True) f, g, h = symbols('f g h', cls=Function) import inspect class A: @staticmethod def __additionFunction__(a1, a2): return a1*a2 #Put what

Is there a free graph library to show program flow by tranverse AST tree

2016-10-10 Thread Ho Yeung Lee
can this graph library handle recursive function call this symbol If it recursive call a function 3 times then in the inner loop call another function , can this graph library Show this relationship I find video that viv can show this program flow. --

Re: how to refactor nested for loop into smaller for loop assume each of them independent?

2016-10-10 Thread Ho Yeung Lee
I updated the code in msdn forum, I calculated from the end of file Discover file 4550 takes a long time to run, Assume it runs a whole day a file, 4550 days I guess need 12 years to finish full combination if only run at home. Hope Python sympy can be faster than cmaple in Amazon instance

Re: how to refactor nested for loop into smaller for loop assume each of them independent?

2016-10-10 Thread Ho Yeung Lee
Sorry my calculation is wrong, it should have around 14 billions of combinations after using program to count. -- https://mail.python.org/mailman/listinfo/python-list

How to split a large nested for loop and distribute to hundreds of Amazon instance to run this kind of Python code?

2016-10-09 Thread Ho Yeung Lee
https://social.msdn.microsoft.com/Forums/vstudio/en-US/5f0a9a51-a256-4671-a5fc-e213949e7204/how-to-refactor-3-nested-for-loop-into-smaller-for-loop-assume-each-of-them-independent?forum=csharpgeneral I wrote a algorithm to split for loop to generate maplesoft code for limited memory Assume I

How to read maple .m file into Python?

2016-10-09 Thread Ho Yeung Lee
i saved a list of matrix of algebra into .m file in maple How to read and import into Python for sympy to use? -- https://mail.python.org/mailman/listinfo/python-list

Re: 'str' object has no attribute 'intersection' and unhashable set (Reposting On Python-List Prohibited)

2016-10-05 Thread Ho Yeung Lee
i do not understand, how to solve this frozonset ? Lawrence D’Oliveiro於 2016年10月5日星期三 UTC+8下午2時24分13秒寫道: > On Wednesday, October 5, 2016 at 2:35:25 PM UTC+13, meInvent bbird wrote: > > it return unhashable type 'set' > > This is what “frozenset” is for--it’s the immutable counterpart of

Re: how to python to use virtual memory?

2016-06-25 Thread Ho Yeung Lee
what is the command or code to write to use virtual memory if i use extra 20 GB from hard disk as memory, means from 70GB memory to 90GB memory and left 10GB for file? Michael Torrie於 2016年6月25日星期六 UTC+8上午11時00分36秒寫道: > On 06/24/2016 08:44 PM, Dennis Lee Bieber wrote: > > I don't know how

Re: which library has map reduce and how to use it for this case

2016-06-09 Thread Ho Yeung Lee
path = [] mresult = DFS(b, 2, 2, mylist, path) Michael Selik於 2016年6月10日星期五 UTC+8上午6時45分14秒寫道: > I like using Yelp's mrjob module (https://github.com/Yelp/mrjob) to run > Python on Hadoop. > > On Thu, Jun 9, 2016 at 2:56 AM Ho Yeung Lee <davidbenny2...@gmail.com> > wrote

why it is like stop running after a 3 seconds

2016-06-09 Thread Ho Yeung Lee
i write a program, it is like forever loop but i only restrict it to run 2 level recursively, why it is slow, where is the problem? M1 = {} M2 = {} M3 = {} M4 = {} M5 = {} V6 = {} M1['00']=0 M1['01']=1 M1['02']=1 M1['10']=2 M1['11']=2 M1['12']=1 M1['20']=1 M1['21']=2 M1['22']=1 M2['00']=0

which library has map reduce and how to use it for this case

2016-06-09 Thread Ho Yeung Lee
i got M1 to M5 and V6 operator and would like to do a full combination and result will also act among each other, map reduce attract my application how to use this in this example? actually below is like vlookup then example is op3(op2(op1(x->y, y->z)), x->z) search which combinations will

how to notify among the def and can network communication such as zeromq for python do this?

2016-02-23 Thread Ho Yeung Lee
in the following code, node 3 and node 4 running parallel if there are 100 nodes running parallel, how can they notify each other i find this post stackoverflow, http://stackoverflow.com/questions/29324346/how-do-i-connect-asyncio-coroutines-that-continually-produce-and-consume-data if

Re: how to get the list form dictionary's values

2016-02-21 Thread Ho Yeung Lee
Peter Otten於 2016年2月21日星期日 UTC+8下午10時07分18秒寫道: > davidbenny2...@gmail.com wrote: > > > File "mainpy.py", line 81 > > for functionlistelement in functionlist0 > >^ > > SyntaxError: invalid syntax > > > > > > import asyncio > > [snip] > > >

Re: how to get the list form dictionary's values

2016-02-21 Thread Ho Yeung Lee
Hi Chris, 0 ---> 2 --> 3--> 1 ---> 0 ---> 4 / i am practicing task flow in this graph situation when current state is 2 , there are 3 and 4 to run parallel and wait list of tasks finish before running to 1 , however i feel that my code has been wrong because 3 and 4 can not combine