Re: newbie: installing setuptools
- Original Message - > From: "Surbhi Gupta" > OK, the problem is now resolved: I just found out that we need to > install from prompt instead of IDLE. > Setuptools is installed, but I am not able to use easy_install from > prompt. It says: > easy_install : The term 'easy_install' is not recognized as the name > of a cmdlet, function, script file, or operable > program. Check the spelling of the name, or if a path was included, > verify that the path is correct and try again. > At line:1 char:1 > + easy_install > + > + CategoryInfo : ObjectNotFound: (easy_install:String) > [], CommandNotFoundException > + FullyQualifiedErrorId : CommandNotFoundException > > still unsuccessful in installing Scipy. Assuming you are using windows, you must first install setuptools using the binary you'll find on the internet. Then you must add some path(s) to your PATH environment variable, something to change in the window configuration menu. Probably something in C:\Python2.7\scripts, I can't remember. full doc: https://docs.python.org/2/using/windows.html JM -- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you. -- https://mail.python.org/mailman/listinfo/python-list
Re: how to generate a wsdl file for a web service in python
Le jeudi 18 décembre 2014 11:46:00 UTC, Burak Arslan a écrit : > On 12/18/14 11:58, brice DORA wrote: > > hi to all I am new to python and as part of my project I would like to > > create a SOAP web service. for now I've developed my python file with all > > the methods of my future web service, but my problem now is how to generate > > the wsdl file ... my concern may seem to move so bear with me because I am > > a novice in this field. thank you in advance > > > Hi, > > You can use Spyne to generate the wsdl file. > > http://spyne.io/docs/2.10/manual/02_helloworld.html > https://github.com/arskom/spyne/blob/master/examples/helloworld_soap.py > > There's also s...@python.org for your soap-specific questions. > > best, > burak okey thanks u but this example use a simple method then in my case i have already my python file which contains all methods of my web service. so do you give a example or tell me how i can do it... i want to create the web service and deploying it from my python file...thanks very much in advance -- https://mail.python.org/mailman/listinfo/python-list
[RELEASE] ‘python-daemon’ version 1.5.7 released
Howdy all, I am pleased to announce the release of version 1.5.7 of the ‘python-daemon’ library. The current release is always available at https://pypi.python.org/pypi/python-daemon/>. The project's forums and VCS are hosted at Alioth https://alioth.debian.org/projects/python-daemon/>. Significant changes since the previous version == * Declare support explicitly for Python 2 only. * Document the security impact and rationale of the default umask. * Migrate the test suite to use maintained, current libraries (‘unittest2’, ‘mock’, ‘testtools’, ‘testscenarios’). Drop dependencies on obsolete libraries. * Include test suite with source distribution. * Add a hacking guide for developers. * Multiple changes to prepare for Python 3 migration. What is the ‘python-daemon’ library? ‘python-daemon’ is a Python library to implement a well-behaved Unix daemon process. -- \“Intellectual property is to the 21st century what the slave | `\ trade was to the 16th.” —David Mertz | _o__) | Ben Finney -- https://mail.python.org/mailman/listinfo/python-list
Bug? Feature? setattr(foo, '3', 4) works!
I'm bringing this discussion over from the python-ideas mailing list to see what people think. I accidentally discovered that the following works, at least in Python 3.4.2: >>> class foo(object): ... pass ... >>> setattr(foo, '3', 4) >>> dir(foo) ['3', '__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__'] >>> getattr(foo, '3') 4 >>> bar = foo() >>> dir(bar) ['3', '__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__'] >>> getattr(bar, '3') 4 >>> hasattr(foo, '3') True >>> hasattr(bar, '3') True However, the following doesn't work: >>> foo.3 File "", line 1 foo.3 ^ SyntaxError: invalid syntax >>> bar.3 File "", line 1 bar.3 ^ SyntaxError: invalid syntax I'd like to suggest that getattr(), setattr(), and hasattr() all be modified so that syntactically invalid statements raise SyntaxErrors. In messages on python-ideas, Nick Coghlan mentioned that since a Namespace is just a dictionary, the normal error raised would be TypeError and not SyntaxError; I'd like to suggest special-casing this so that using getattr(), setattr(), and hasattr() in this way raise SyntaxError instead as I think that will be less astonishing. Thoughts? Thanks, Cem Karan -- https://mail.python.org/mailman/listinfo/python-list
Re: Bug? Feature? setattr(foo, '3', 4) works!
Cem Karan writes: > However, the following doesn't work: > > >>> foo.3 > File "", line 1 >foo.3 >^ > SyntaxError: invalid syntax > >>> bar.3 > File "", line 1 >bar.3 >^ > SyntaxError: invalid syntax > > I'd like to suggest that getattr(), setattr(), and hasattr() all be > modified so that syntactically invalid statements raise SyntaxErrors. What syntactically invalid statements? The only syntactically invalid statements I see you presenting are ones that *already* raise SyntaxError. I think you mean that setting an attribute on an object should be a SyntaxError if the resulting attribute's name is not a valid identifier. But why should a valid statement produce SyntaxError? I'm −1 on such a change. -- \ “Education is learning what you didn't even know you didn't | `\ know.” —Daniel J. Boorstin, historian, 1914–2004 | _o__) | Ben Finney -- https://mail.python.org/mailman/listinfo/python-list
Re: Bug? Feature? setattr(foo, '3', 4) works!
On 12/19/14 6:40 AM, Cem Karan wrote: I'm bringing this discussion over from the python-ideas mailing list to see what people think. I accidentally discovered that the following works, at least in Python 3.4.2: class foo(object): ... pass ... setattr(foo, '3', 4) dir(foo) ['3', '__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__'] getattr(foo, '3') 4 bar = foo() dir(bar) ['3', '__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__'] getattr(bar, '3') 4 hasattr(foo, '3') True hasattr(bar, '3') True However, the following doesn't work: foo.3 File "", line 1 foo.3 ^ SyntaxError: invalid syntax bar.3 File "", line 1 bar.3 ^ SyntaxError: invalid syntax I'd like to suggest that getattr(), setattr(), and hasattr() all be modified so that syntactically invalid statements raise SyntaxErrors. In messages on python-ideas, Nick Coghlan mentioned that since a Namespace is just a dictionary, the normal error raised would be TypeError and not SyntaxError; I'd like to suggest special-casing this so that using getattr(), setattr(), and hasattr() in this way raise SyntaxError instead as I think that will be less astonishing. Thoughts? Thanks, Cem Karan Can you explain why you think it is important that setattr(obj, '3', 3) raise an error at all? Yes, it surprised you, but there are many aspects of Python that are surprising. That's not a bad thing in and of itself. Did this cause a real problem in your code? Is there a way that allowing non-identifier attribute names will be harmful? -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list
Re: Bug? Feature? setattr(foo, '3', 4) works!
On 12/19/2014 06:40 AM, Cem Karan wrote: I'm bringing this discussion over from the python-ideas mailing list to see what people think. I accidentally discovered that the following works, at least in Python 3.4.2: class foo(object): ... pass ... setattr(foo, '3', 4) dir(foo) ['3', '__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__'] getattr(foo, '3') However, the following doesn't work: foo.3 File "", line 1 foo.3 ^ SyntaxError: invalid syntax bar.3 File "", line 1 bar.3 ^ SyntaxError: invalid syntax I'd like to suggest that getattr(), setattr(), and hasattr() all be modified so that syntactically invalid statements raise SyntaxErrors. In messages on python-ideas, Nick Coghlan mentioned that since a Namespace is just a dictionary, the normal error raised would be TypeError and not SyntaxError; I'd like to suggest special-casing this so that using getattr(), setattr(), and hasattr() in this way raise SyntaxError instead as I think that will be less astonishing. They are NOT syntactically invalid, but perhaps you mean they should be considered semantically invalid. That's a very important distinction. Suppose for example the function call is setattr(foo, name, value) If the setattr() call is made inside a function, there's no way that the compiler could detect it as a syntax error. IF YOU decide it should be a runtime error, then labelling it as a syntax error would be very confusing to anyone who understands the compile process. I personally don't think it should be an error at all, and that current behavior is just fine. -- DaveA -- https://mail.python.org/mailman/listinfo/python-list
Re: Bug? Feature? setattr(foo, '3', 4) works!
On 12/19/2014 6:40 AM, Cem Karan wrote: I'm bringing this discussion over from the python-ideas mailing list to see what people think. I accidentally discovered that the following works, at least in Python 3.4.2: class foo(object): ... pass ... setattr(foo, '3', 4) dir(foo) ['3', '__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__'] getattr(foo, '3') 4 bar = foo() dir(bar) ['3', '__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__'] getattr(bar, '3') 4 hasattr(foo, '3') True hasattr(bar, '3') True The fact that one has set and retrieve non-identifier attributes has always been true and known and discussed before. Guido has declared that it should continue to work rather than break code that uses this fact (and their is apparently such). This follows under Python's 'consenting adults' policy. The attribute 'name' is type-checked to be a string. >>> class C: pass >>> c = C() >>> setattr(c, 3, '3') Traceback (most recent call last): File "", line 1, in setattr(c, 3, '3') TypeError: attribute name must be string, not 'int' >>> setattr(c, b'3', '3') Traceback (most recent call last): File "", line 1, in setattr(c, b'3', '3') TypeError: attribute name must be string, not 'bytes' If one accesses the dict directly, even the string limitation is bypassed, but one suffers the consequences. >>> c.__dict__[3] = 3 >>> dir(c) Traceback (most recent call last): File "", line 1, in dir(c) TypeError: unorderable types: int() < str() Thoughts? Don't pursue this. Leave good enough alone. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Create New Comment In Xenforo
Hi, https://xenforo.com/community/threads/nbsp-nbsp-nbsp-nbsp-nbsp-nbsp-nbsp-nbsp-nbsp-nbsp-nbsp-nbsp-nbsp-nbsp.3864/ i want to add new comment "thanks" to above topic It can login but can not reply topic. Here my code, please help me fix. Thanks a lot import requests with requests.session() as c: url='https://xenforo.com/community/login/login' USERNAME='minnecon...@gmail.com' PASSWORD='Demo12345' c.get(url) session=requests.session() login_data=dict(login=USERNAME,password=PASSWORD,next="/") c.post(url,data=login_data,headers={"Referer":"https://xenforo.com/community/"}) thisvalues='Thanks' thisurl='https://xenforo.com/community/threads/nbsp-nbsp-nbsp-nbsp-nbsp-nbsp-nbsp-nbsp-nbsp-nbsp-nbsp-nbsp-nbsp-nbsp.3864/' r=requests.post(thisurl,data=thisvalues) session.close() session.__exit__() -- https://mail.python.org/mailman/listinfo/python-list
Re: Bug? Feature? setattr(foo, '3', 4) works!
On Fri, Dec 19, 2014, at 07:23, Ben Finney wrote: > Cem Karan writes: > > I'd like to suggest that getattr(), setattr(), and hasattr() all be > > modified so that syntactically invalid statements raise SyntaxErrors. > > What syntactically invalid statements? The only syntactically invalid > statements I see you presenting are ones that *already* raise > SyntaxError. > > I think you mean that setting an attribute on an object should be a > SyntaxError if the resulting attribute's name is not a valid identifier. > But why should a valid statement produce SyntaxError? > > I'm −1 on such a change. And some APIs - ctypes, for example - actually require using getattr with an invalid identifier in some cases (where attribute access is used for an underlying concept with names that are usually, but not always, valid identifiers: in ctypes' case, looking up symbols from DLLs.) -- https://mail.python.org/mailman/listinfo/python-list
Re: newbie: installing setuptools
On 19/12/2014 04:43, Surbhi Gupta wrote: Hey, I am new to python and facing problem with installing packages. I am using VPython which requires Python 2.7.x from python.org; it will not work with versions of Python other than the one from python.org. So I need to install packages separately. I was trying to install scipy-0.14.0, it gives following error: Warning (from warnings module): File "C:\Python27\lib\distutils\dist.py", line 267 warnings.warn(msg) UserWarning: Unknown distribution option: 'test_suite' So I thought maybe I need to install setuptools first. I ran setup.py file in IDLE. it runs fine and then I can import it in current session. But when I run session, it still says 'no module named setuptools'. Same thing happened when I tried to install nose. If you've got Python 2.7.9 just use pip as it's far easier. This https://docs.python.org/release/2.7.9/whatsnew/2.7.html#pep-477-backport-ensurepip-pep-453-to-python-2-7 refers. If you still can't install a package as you've not got Visual Studio C++ try downloading a binary from here http://www.lfd.uci.edu/~gohlke/pythonlibs/ -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence -- https://mail.python.org/mailman/listinfo/python-list
Advice needed - Choosing appropriate GUI (IDE) and Data Visualization software (3D also)
Hello guys, Here is a brief description for my question: I'm currently dealing with my EE B.Sc. final project. This projects generally relates to the SDN Optical Networks. One of its goals is to build some GUI framework based on mininet software (http://mininet.org/) Mostly, I'll need expand its capabilities and add some new features for Layer 1. As a general concept I need to build something which looks like that: 1. http://www.brianlinkletter.com/wp-content/uploads/2014/01/GNS3-setup-Virtual Box-9.png or that (even better): 2. https://www.safaribooksonline.com/library/view/learning-omnet/9781849697149/ graphics/7149OT_02_03.jpg When at middle window I'll place my interactive display, which (at initial state) should look like this one: 3. http://3.bp.blogspot.com/_2bTtOorcilA/S-jVtqNy0xI/AAM/R9l6L26yAV0/s1 600/ChordIPv4.png I said 'interactive' because it need to be: scalable, zoomable, movable(and other "able") ^_^ Moreover it actually need to provide access to device properties, for instance behave (at least) like that one: 4. http://youtu.be/XAzXKnAwKxo?t=4m20s Finally I found this one : 5. http://youtu.be/L-ad0Phy0eI?t=10s This one looks awesome! ))) This is an interactive model to which I want to aspire. Furthermore, if this design: 6. https://www.youtube.com/watch?v=JsEm-CDj4qM could be implemented to the above links, this will realize my "wet dream" of blurry bubbles and shaded backgrounds Of course, as a EE student I'll tend more to the practical side rather than design. But still it could be nice to make some good looking product. In conclusion: 1. For my core GUI(IDE) I'll likely use PythonQt. I've read couple of reviews , most of them say that this one good for beginners. Of cause, if there any other frameworks that worth to consider, and seems more suitable for beginners, I would be glad to hear for your advice. Here I need most of your help: 2. The interactive "middle window", unfortunately I have no idea what is a suitable software for such kind of things. For almost a week I delve the NET for possible options, there are innumerable quantity of Python packages and tools (my Chrome is blown up with opened tabs), but still don't know what to choose or how to implement this one. (especially link's #5 model) (Python OpenGL? ) 3. For those of you who will ask: why I don't want to take something already done before: My answer will be simple: a. Unfortunately I'm not a guru of programming. My programming scope includes only some C, Matlab, and now Python. For this reason I can't take some modules from "omninet ++" software (which actually written in C++) and implement them in my project. Or for instance to use OpenDayLight software modules I know that I will mess up with this and waste a lot of time for getting it work properly. (But I'm not whining here ^_^) b. I'm short in time (as most of us). I can't afford myself to learn additional languages (at least at this moment) c. My basis software (mininet) is written on Python. d. Most of an existing software for SDN deal with Layer 3. So their models not so suitable for my purposes. I need to redefine a lot of things and build them from scratch. e. In general I think Python can handle all my needs Any advice will be highly appreciated. Sincerely, Ivan. -- https://mail.python.org/mailman/listinfo/python-list
resource based job queue manager
can someone suggest a resource based job queue manager. for eg i have 3 resources and 10 jobs based on the resource busy/free we should start running the jobs. I can write the code but want to know if there is any established scheduler which can run the jobs from different servers too. -- https://mail.python.org/mailman/listinfo/python-list
code python
Hello all I Have problem about , How i can compute accuracy to unigram,bigram and trigram and how i can change the size to iteration separate from 1 to 10 in each stage from iteration train take 90% and training 10%. thank you to read my message import codecs import nltk from nltk import* outfile = codecs.open('unigram_tagged_sents_out.txt','w','utf-8') outfile2 = codecs.open('bigram_tagged_sents_out.txt','w','utf-8') outfile3 = codecs.open('trigram_tagged_sents_out.txt','w','utf-8') File1=codecs.open('C:\project\Corpus_word.txt','r','utf_8').readlines() word_pos_list = [] tokens=[] train_sents=[] test_tagged_sents=[] all_test_sents = [] n=10 for line in File1: tokens = line.split('\t') #print '%s\t%s\t%s' % (tokens[0], tokens[1], tokens[2]) word_pos_list.append((tokens[0], tokens[1])) all_test_sents.append(tokens[0]) for t in range(10): size=int(len(word_pos_list)*(0.9)) #print size train_sents.append(word_pos_list[:size]) test_tagged_sents.append(word_pos_list[size:]) test_sents=all_test_sents[size:] print "unigram tagger" #Unigram tagger unigram_tagger = nltk.UnigramTagger(train_sents) tagged_unigram_sents = unigram_tagger.tag(test_sents) print unigram_tagger.evaluate(test_tagged_sents) for (word, tag) in tagged_unigram_sents: print>>outfile, '%s\t%s' % (word, tag) print nltk.accuracy(tagged_unigram_sents,test_sents) #bigram tagger print "Bigram Tagger" bigram_tagger = nltk.BigramTagger(train_sents,backoff= unigram_tagger) tagged_bigram_sents=bigram_tagger.tag(test_sents) print bigram_tagger.evaluate(test_tagged_sents) for (word, tag) in tagged_bigram_sents: print>>outfile2, '%s\t%s' % (word, tag) #Trigram tagger print "Trigram Tagger" trigram_tagger=nltk.TrigramTagger(train_sents,backoff= bigram_tagger) tagged_trigram_sents=trigram_tagger.tag(test_sents) print trigram_tagger.evaluate(test_tagged_sents) for (word, tag) in tagged_trigram_sents: print>>outfile3, '%s\t%s' % (word, tag) outfile.close() outfile2.close() outfile3.close() print 'Done!' #accuracy = unigram_tagger.evaluate(tagged_test_sents) #print 'accuracy = ', accuracy #train_sents.append((word_pos_list[:size])) #print train_sents #test_sents.append(word_pos_list[size:]) #print test_sents #bigram_tagger=nltk.BigramTagger(train_sents) #print bigram_tagger.tag(tokens[:size]) #print bigram_tagger._train(train_sents,cutoff=size) #print bigram_tagger.evaluate(test_sents) -- https://mail.python.org/mailman/listinfo/python-list
Changing script's search path at install time
Hi all, I have a question regarding installation of Python scripts and modules using distutils that I can't find an answer to by searching through Google and the Python website. Hopefully, someone on this list might have ideas? I am writing a Python app, which I would eventually like to install using disutils. The app has the current tree strucutre: |- myapp.py |- modules/ |-- lib/ |-- __init__.py |-- mymodule1.py |-- mymdule2.py |--- cmds/ |-- __init__.py |-- cmds1.py Naturally, in order for my app to properly import the modules, currently it uses the following code: import modules.lib.mymodule1 import modules.lib.mymodule2 import modules.cmds.cmds1 However, when the app gets installed, I would like to install the modules to /usr/lib64/pythonX.Y/site-packages/myapp. I know that I can do this by using the "package_dir" argument to the "setup()" function in distutils.core. To make development easier I would like to be able to run the myapp.py script from the development directory, which means that the import statements have to remain as they are. The issue is that when the script is installed, the import statements will not work anymore since the directory name has been changed from "modules" to "myapp". My problem is that I can't figure out how to modify the myapp.py script to switch from "modules.lib.mymodule1" to "myapp.lib.module1" at install time. Does anyone have any useful hints? Thank you, - Mitko -- https://mail.python.org/mailman/listinfo/python-list
Re: Google Maps and Python: creating a map, embedding it, adding images, videos, markers, using python
Kevin, that client library looks like it is for accessing Google Maps related services, not modifying maps themselves. On Fri, Dec 19, 2014 at 1:02 AM, Kev Dwyer wrote: > Veek M wrote: > > > I'm messing with Google-Maps. Is there a way I can create a map, embed it > > on a page (CSS/HTML/Javascript for this bit), and add images, videos, > > markers - using python? Any libraries available? > > Hello, > > Googling for "google maps python client" returns > > https://developers.google.com/api-client-library/python/apis/mapsengine/v1 > > as the first result... > > HTH > > Kev > > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list
Re: Changing script's search path at install time
On 12/19/2014 05:51 PM, Mitko Haralanov wrote: Hi all, I have a question regarding installation of Python scripts and modules using distutils that I can't find an answer to by searching through Google and the Python website. Hopefully, someone on this list might have ideas? I am writing a Python app, which I would eventually like to install using disutils. The app has the current tree strucutre: |- myapp.py |- modules/ |-- lib/ |-- __init__.py |-- mymodule1.py |-- mymdule2.py |--- cmds/ |-- __init__.py |-- cmds1.py Naturally, in order for my app to properly import the modules, currently it uses the following code: import modules.lib.mymodule1 import modules.lib.mymodule2 import modules.cmds.cmds1 However, when the app gets installed, I would like to install the modules to /usr/lib64/pythonX.Y/site-packages/myapp. I know that I can do this by using the "package_dir" argument to the "setup()" function in distutils.core. To make development easier I would like to be able to run the myapp.py script from the development directory, Nonsense. It should have the same structure on your machine as your customer will have. So move the modules to where they're really going to be installed, and correct the imports until it tests correct. which means that the import statements have to remain as they are. The issue is that when the script is installed, the import statements will not work anymore since the directory name has been changed from "modules" to "myapp". My problem is that I can't figure out how to modify the myapp.py script to switch from "modules.lib.mymodule1" to "myapp.lib.module1" at install time. Bad idea. Does anyone have any useful hints? Yes, develop in the same environment as the customer is going to run. If for some reason you cannot, then TEST in the same environment as the customer is going to run. If this confuses your source control, or some such other problem, deal with it there. maybe use symlinks, or use a script to "install" the stuff. -- DaveA -- https://mail.python.org/mailman/listinfo/python-list
Re: Changing script's search path at install time
On Friday, December 19, 2014 6:00:15 PM UTC-8, Mitko Haralanov wrote: > Hi all, > > > I have a question regarding installation of Python scripts and modules using > distutils that I can't find an answer to by searching through Google and the > Python website. Hopefully, someone on this list might have ideas? > > > I am writing a Python app, which I would eventually like to install using > disutils. The app has the current tree strucutre: > > > > |- myapp.py > |- modules/ > |-- lib/ > |-- __init__.py > |-- mymodule1.py > |-- mymdule2.py > |--- cmds/ > |-- __init__.py > |-- cmds1.py > > > Naturally, in order for my app to properly import the modules, currently it > uses the following code: > > > import modules.lib.mymodule1 > import modules.lib.mymodule2 > import modules.cmds.cmds1 > > > However, when the app gets installed, I would like to install the modules to > /usr/lib64/pythonX.Y/site-packages/myapp. I know that I can do this by using > the "package_dir" argument to the "setup()" function in distutils.core. > > > To make development easier I would like to be able to run the myapp.py script > from the development directory, which means that the import statements have > to remain as they are. The issue is that when the script is installed, the > import statements will not work anymore since the directory name has been > changed from "modules" to "myapp". > > > My problem is that I can't figure out how to modify the myapp.py script to > switch from "modules.lib.mymodule1" to "myapp.lib.module1" at install time. > Does anyone have any useful hints? > > > Thank you, > - Mitko Don't call that subdirectory "modules". Call it "myappmodules" or something like that. The modules would then be installed in /usr/lib64/pythonX.y/site-packages/myappmodules I'm sure there's a work-around that would let you refer to them by different names based on whether or not the script is being run from your development directory, but it would probably be a Bad Idea and could easily break on some peoples' systems. Alternatively, you could decide if you really need those modules to be installed as stand-alone modules in the site-packages directory. Are users going to be importing those modules into their own scripts? -- https://mail.python.org/mailman/listinfo/python-list
Re: Changing script's search path at install time
Dave Angel writes: > On 12/19/2014 05:51 PM, Mitko Haralanov wrote: > > However, when the app gets installed, I would like to install the > > modules to /usr/lib64/pythonX.Y/site-packages/myapp. I know that I > > can do this by using the "package_dir" argument to the "setup()" > > function in distutils.core. > > > > To make development easier I would like to be able to run the > > myapp.py script from the development directory, > > Nonsense. It should have the same structure on your machine as your > customer will have. So move the modules to where they're really going > to be installed, and correct the imports until it tests correct. To clarify: the application should install its files into a directory tree, with the same *relative* structure on your machine as on the customer's machine. (More complex setups are reasonable, too; operating systems can manage where executable versus documentation versus library versus static data files etc. should go, meaning the locations will be different on different machines. But that's probably not needed in this case.) > > The issue is that when the script is installed, the import > > statements will not work anymore since the directory name has been > > changed from "modules" to "myapp". In that case, ensure the deployment (whether for testing on your own machine, or onto a production machine) goes to a directory with the same top-level Python package name. > > Does anyone have any useful hints? > > Yes, develop in the same environment as the customer is going to run. One point to note: there's no issue having the *development* working tree different for convenience of editing and VCS management, etc. But for running the program &-N even for testing &-N you should set up an automated one-command deployment that compiles, builds, copies, deployed, etc. anything it needs to, to run whatever it is you've just edited. Just because Python code can be runn immediately, that doesn't remove the need for a separate build step to go from “tree of files I'm editing and managing in VCS”, to “tree of files in a different location ready to run”. -- \ “Some people have a problem, and they think “I know, I'll use | `\ Perl!”. Now they have some number of problems but they're not | _o__) sure whether it's a string or an integer.” —Benno Rice, 2011 | Ben Finney -- https://mail.python.org/mailman/listinfo/python-list
regex tool in the python source tree
I remember seeing here (couple of weeks ago??) a mention of a regex debugging/editing tool hidden away in the python source tree. Does someone remember the name/path? There are of course dozens of online ones... Looking for a python native tool -- https://mail.python.org/mailman/listinfo/python-list
Re: regex tool in the python source tree
On Saturday, December 20, 2014 12:01:10 PM UTC+5:30, Rustom Mody wrote: > I remember seeing here (couple of weeks ago??) a mention of a regex > debugging/editing tool hidden away in the python source tree. > > Does someone remember the name/path? > > There are of course dozens of online ones... > Looking for a python native tool Ok I found redemo here https://docs.python.org/3/howto/regex.html Should also mention that that link mentions kodos as though it works. The kodos site http://sourceforge.net/projects/kodos/files/ shows old as 2002 new as 2006. Last I tried it did not work for python2.7 even leave aside 3.x. If theres anything more uptodate, I'd like to know -- https://mail.python.org/mailman/listinfo/python-list