why i cannot invoke python script using command line?

2011-08-23 Thread smith jack
but i can invoke it in eclipse, what's wrong? the script refered to another python script in eclipse project. f:\project\src\a.py f:\project\src\lib\b.py there is such lines in a.py from lib import b i can invoke a.py very well in eclipse but failed when using python f:\project\src\a.py, what's

is there any principle when writing python function

2011-08-23 Thread smith jack
i have heard that function invocation in python is expensive, but make lots of functions are a good design habit in many other languages, so is there any principle when writing python function? for example, how many lines should form a function? -- http://mail.python.org/mailman/listinfo/python-li

How to build python using visual studio 2005?

2011-08-17 Thread smith jack
anybody here have build it correctly? how to make a msi file just as the official site did? is there any detailed tutorial online? -- http://mail.python.org/mailman/listinfo/python-list

Some warning appears when installing virtualenv, does it matters?

2011-08-17 Thread smith jack
the warning is just as follows E:\Tools>pip install virtualenv Downloading/unpacking virtualenv Downloading virtualenv-1.6.4.tar.gz (1.9Mb): 1.9Mb downloaded Running setup.py egg_info for package virtualenv warning: no previously-included files matching '*.*' found under directory ' do

why i cannot import djang?

2011-08-16 Thread smith jack
this package is already in the site-packages directory, but i cannot import it , it's really confusing ... -- http://mail.python.org/mailman/listinfo/python-list

Failed to create virtual environment when using --relocatable option, what's wrong?

2011-08-16 Thread smith jack
all things works well without --relocatable option, the error info when using --relocatable option is as follows : F:\PythonEnv\djangoEnv>virtualenv f:\PythonEnv\djangoEnv2 --relocatable PYTHONHOME is set. You *must* activate the virtualenv before using it The environment doesn't have a file f:\P

How to install easy_install on windows ?

2011-08-16 Thread smith jack
it needs read registry, but the python i used is extracted from .zip, so there is no record in the registry, what should i do in order to install easy_install for my python environment? -- http://mail.python.org/mailman/listinfo/python-list

Anyone here can do a comparation between Djang and RoR

2011-08-16 Thread smith jack
what is the advantage of Django over RoR:) -- http://mail.python.org/mailman/listinfo/python-list

How to use python environment created using virtualenv?

2011-08-15 Thread smith jack
I have created a python environment using virtualenv, but when i want to import such environment to PyDev, error just appears, it tells there should be a Libs dir, but there is no Libs DIr in the virtual envronment created using virtualenv, what should i do if i want to use this virtual environment

module import error, what's wrong?

2011-08-07 Thread smith jack
from common.URLTool import URLTool tool = URLTool() Traceback (most recent call last): File "E:\workspace\url\test.py", line 7, in ? from common.URLTool import URLTool ImportError: No module named common.URLTool URLTools is a class write by myself, it works well ,but cannot be imported in t

how to separate a list into two lists?

2011-08-06 Thread smith jack
if a list L is composed with tuple consists of two elements, that is L = [(a1, b1), (a2, b2) ... (an, bn)] is there any simple way to divide this list into two separate lists , such that L1 = [a1, a2... an] L2=[b1,b2 ... bn] i do not want to use loop, any methods to make this done? -- http://mai

How to make the program support communication behind NAT device?

2011-08-06 Thread smith jack
The subnet behind my router is 192.168.1.0/24, my pc ip is 192.168.1.9, the server written with python is hosted on 192.168.1.3 on port 1033, i can connect to this server from my pc But cannot connect to this server when outside of this subnet? why? I have made port translate on router, that is 1

Re: can virtualenv run without the main installation?

2011-08-06 Thread smith jack
env create by virtualenv will refer to the main env, how did it find the main env, is there any configuration files, if yes, where is it? 2011/8/6 smith jack : > At first i have a python environment, after using virtualenv test > command, a new environment named test is created, in that dir

can virtualenv run without the main installation?

2011-08-06 Thread smith jack
At first i have a python environment, after using virtualenv test command, a new environment named test is created, in that directory have some of the executable commands such as python.exe, so can i program without the main installation of python? -- http://mail.python.org/mailman/listinfo/python

what is the advantage of Django when comparing with LAMP and J2EE platform?

2011-08-02 Thread smith jack
There are so many choice to do the same thing, so is there any special advantage Django brings to user? -- http://mail.python.org/mailman/listinfo/python-list

how to sort a hash list without generating a new object?

2011-08-02 Thread smith jack
the source code is as follows x={} x['a'] = 11 x['c'] = 19 x['b'] = 13 print x tmp = sorted(x.items(), key = lambda x:x[0])# increase order by default, if i want to have a descending order, what should i do? # after sorted is called, a list will be generated, and the hash list x is not chang

How to define repeated string when using the re module?

2011-08-02 Thread smith jack
if it's for a single character, this should be very easy, such as c{m,n} the occurrence of c is between m and n, if i want to define the occurrence of (.*?) how should make it done? ((.*?)){1,3} seems not work, any method to define repeat string using python regex? -- http://mail.python.org/

python import error, what's wrong?

2011-08-02 Thread smith jack
I am using pydev plugin in eclipse, all things works just as well but now i have confronted with a confusing problem, that is i can import a module write by myself successfully, but when i try to run this program, error just shows up, what's wrong? the directory structure is as follows: src org

Any suggestion to start more threads at the same time?

2011-07-28 Thread smith jack
I start many threads in order to make the work done, when the concurrent number is set to 300, all thing just works fine, but when the number is set to 350 or higher, error just comes out? what's wrong ? the error info is just as follows: failed to start . I am confused, does this have something

why the following python program does not face any concurrency problems without synchronize mechanism?

2011-07-09 Thread smith jack
from threading import Thread def calc(start, end): total = 0; for i in range(start, end + 1): total += i; print '--result:', total return total t = Thread(target=calc, args=(1,100)) t.start() I have run this program for many times,and the result is alw