Re: [Tutor] Using __init__ to return a value
On Wed, Jun 12, 2013 at 3:02 PM, Khalid Al-Ghamdi emailkg...@gmail.comwrote: Hi, Why doesn't this work? And is there way to have an object immediately return a value or object once it is instantiated with using a method call? __init__ returns the newly created object. You cannot (or at least shouldn't) return something else. Try making whatever you want to return an instance variable (or function). Refer this thread http://stackoverflow.com/questions/2491819/python-init-how-to-return-a-value 1. class k: 2. def __init__(self,n): 3. return n*n 4. 5. 6. khalid=k(3) 7. Traceback (most recent call last): 8. File pyshell#58, line 1, in module 9. khalid=k(3) 10. TypeError: __init__() should return None, not 'int' ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor -- Vishwajeet Singh +91-9657702154 | dextrou...@gmail.com | http://bootstraptoday.com Twitter: http://twitter.com/vishwajeets | LinkedIn: http://www.linkedin.com/in/singhvishwajeet ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] help for a beginner
On Sat, Jan 12, 2013 at 12:28 AM, MDB bashya...@gmail.com wrote: Hi, I am a beginner to progrmming and want to learn basic python. I am a scientist (with less math background) with absolutely no programming experience. Are there any web based tutorials/videos/books to learn python. The best book for beginners in my experience is Python for Absolute Beginners, I liked it's approach in making learning a bit fun. A good online resource is http://www.alan-g.me.uk/ Any help is deeply appreciated, thanks Murail -- Murali Dharan Bashyam, PhD, MNAScI Staff Scientist and Chief, Laboratory of Molecular Oncology, Centre for DNA Fingerprinting and Diagnostics (CDFD), Tuljaguda complex, Nampally, Hyderabad 51, INDIA Ph: 91-40-24749383 Fax: 91-40-24749448 ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor -- Vishwajeet Singh +91-9657702154 | dextrou...@gmail.com | http://bootstraptoday.com Twitter: http://twitter.com/vishwajeets | LinkedIn: http://www.linkedin.com/in/singhvishwajeet ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] (no subject)
On Fri, Sep 28, 2012 at 9:44 AM, CHERRY PHOUTHAVONG phou...@sbcglobal.netwrote: I would like tutorial ? Thank You What tutorial ? ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor -- Vishwajeet Singh +91-9657702154 | dextrou...@gmail.com | http://bootstraptoday.com Twitter: http://twitter.com/vishwajeets | LinkedIn: http://www.linkedin.com/in/singhvishwajeet ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] help with program from learning python the hard way
On Thu, Jan 19, 2012 at 6:32 PM, Jason Loeve jasonlo...@gmail.com wrote: good day i seem to be stuck, my code is from sys import argv script, user_name = argv Are you passing an additional parameter while executing the script ?? you must execute it passing an additional parameter which will get assigned to user_name and i get an error ValueError: need more than 1 value to unpack http://learnpythonthehardway.org/book/ex14.html i am using PyCharm 1.5.4 to run thanks in advance jason ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor -- Vishwajeet Singh +91-9657702154 | dextrou...@gmail.com | http://bootstraptoday.com Twitter: http://twitter.com/vishwajeets | LinkedIn: http://www.linkedin.com/in/singhvishwajeet ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Using .po translation file
2011/8/3 Григор Колев grigor.ko...@gmail.com Hi. Some one help me. Haw can I use .po translation file for my program. cat = gettext.Catalog(domain, localedir) what should be domain Domain is usually the name of po file it defaults to django and djangojs in some cases. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor -- Vishwajeet Singh +91-9657702154 | dextrou...@gmail.com | http://bootstraptoday.com Twitter: http://twitter.com/vishwajeets | LinkedIn: http://www.linkedin.com/in/singhvishwajeet ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] I am looking for a book on Beginners who never programmed before or have no experience in programming
On Sun, Sep 26, 2010 at 9:20 AM, Preetinder Singh putj...@yahoo.com wrote: Hi I am trying to learn how to program, I want to become a software developer so I can develop a software and also understand how to write my own software not copying someone else. So if there any book or online tutorials for complete beginners. I went to the python website and on wiki python and there are so many books to choose from, please help me choose one. I would recommend Python for Absolute Beginners. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor -- Vishwajeet Singh +91-9657702154 | dextrou...@gmail.com | http://bootstraptoday.com Twitter: http://twitter.com/vishwajeets | LinkedIn: http://www.linkedin.com/in/singhvishwajeet ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] can i run the last saved input again
On Sat, Jul 24, 2010 at 11:16 AM, ANKUR AGGARWAL coolankur2...@gmail.comwrote: hey this is a crazy question but i want to know it.. suppose i have this code a=raw_input(enter the string :) print a then i type python prog.py output: enter the string:hello hello now i want to ask is there's any way that python remembers the input i gave it to last time and it just give me the output when i again run python prog.py?? i mean i dont need to give input again. I just need to give input only first time and when i run the prog again it will pick up the previous one output is it possible??? you need to serialize the input as everything goes out of memory once program exits. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor -- Vishwajeet Singh +91-9657702154 | dextrou...@gmail.com | http://bootstraptoday.com Twitter: http://twitter.com/vishwajeets | LinkedIn: http://www.linkedin.com/in/singhvishwajeet ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] datetime.strptime not matching timezone in format
Dear All, I am trying to convert date string to datetime using datetime.strptime and when there is timezone part in string conversion is throwing errors. Here is what I am doing string_date = somedate.strftime(%a, %d %b %Y %H:%M:%S %Z) and than later in some other part of code actual_date = datetime.strptime(string_date,%a, %d %b %Y %H:%M:%S %Z) I am getting following error for this conversion *time data 'Tue, 04 May 2010 14:59:45 +05:30' does not match format '%a, %d %b %Y %H:%M:%S %Z'* All formats without timezone works perfectly fine. -- Vishwajeet Singh +91-9657702154 | dextrou...@gmail.com | http://bootstraptoday.com Twitter: http://twitter.com/vishwajeets | LinkedIn: http://www.linkedin.com/in/singhvishwajeet ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] datetime.strptime not matching timezone in format
On Tue, May 4, 2010 at 4:17 PM, Abhishek Mishra ideam...@gmail.com wrote: %Z stands for time zone name in letters Eg. IST or EDT or GMT, so it would fail to parse +05:30 Ahh...ok thanks for pointing that out but this is kind of stranges as I am using same format to convert than why it's not converting it in IST ? However I do not have a solution to your problem but a footnote as hint - http://docs.python.org/library/time.html#id1 Thanks for the link I am browsing this from morning not much of help there. -- Abhishek On Tue, May 4, 2010 at 3:17 PM, vishwajeet singh dextrou...@gmail.comwrote: Dear All, I am trying to convert date string to datetime using datetime.strptime and when there is timezone part in string conversion is throwing errors. Here is what I am doing string_date = somedate.strftime(%a, %d %b %Y %H:%M:%S %Z) and than later in some other part of code actual_date = datetime.strptime(string_date,%a, %d %b %Y %H:%M:%S %Z) I am getting following error for this conversion *time data 'Tue, 04 May 2010 14:59:45 +05:30' does not match format '%a, %d %b %Y %H:%M:%S %Z'* All formats without timezone works perfectly fine. -- Vishwajeet Singh +91-9657702154 | dextrou...@gmail.com | http://bootstraptoday.com Twitter: http://twitter.com/vishwajeets | LinkedIn: http://www.linkedin.com/in/singhvishwajeet ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor -- Vishwajeet Singh +91-9657702154 | dextrou...@gmail.com | http://bootstraptoday.com Twitter: http://twitter.com/vishwajeets | LinkedIn: http://www.linkedin.com/in/singhvishwajeet ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] help
On Mon, Mar 29, 2010 at 7:30 AM, Oshan Modi modi.os...@gmail.com wrote: i am only a novice and just started programming.. i am having trouble running a .py file in the command prompt.. if anyone of you could help? How are you trying to run it ?? -- Vishwajeet Singh +91-9657702154 | dextrou...@gmail.com | http://singhvishwajeet.com | http://bootstraptoday.com Twitter: http://twitter.com/vishwajeets | LinkedIn: http://www.linkedin.com/in/singhvishwajeet ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Hello
On Thu, Jan 21, 2010 at 11:03 PM, Samuel de Champlain samueldechampl...@gmail.com wrote: This is my first message to this mailing list. I want to create a project with glade and pygtk on fedora. Can you suggest a good IDE? netbeans have worked quite well for me but its heavy weight if you are looking for something light check out komodo. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor -- Vishwajeet Singh +91-9657702154 | dextrou...@gmail.com | http://singhvishwajeet.com Twitter: http://twitter.com/vishwajeets | LinkedIn: http://www.linkedin.com/in/singhvishwajeet ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] Array slices in python with negative step
Hello All, I am bit confuse how the slice works in case a negative step is supplied a = 'abcde' a[::-1] gives me edcba but [4:0:-1] gives me edcb while searching net I came accross something which said the following: If a negative stride is specified and the starting or stopping indices are omitted, they default to ``end of axis'' and ``beginning of axis'' respectively. In my case 4 is end of axis and 0 is begining of the axis so a[::-1] should be equivalent to [4:0:-1] but result which I get in both the cases does not validate. -- Vishwajeet Singh +91-9657702154 | dextrou...@gmail.com | http://singhvishwajeet.com Twitter: http://twitter.com/vishwajeets | LinkedIn: http://www.linkedin.com/in/singhvishwajeet ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Array slices in python with negative step
On Mon, Jan 11, 2010 at 10:32 PM, spir denis.s...@free.fr wrote: On Mon, 11 Jan 2010 21:50:10 +0530 vishwajeet singh dextrou...@gmail.com wrote: Hello All, I am bit confuse how the slice works in case a negative step is supplied a = 'abcde' a[::-1] gives me edcba but [4:0:-1] gives me edcb while searching net I came accross something which said the following: If a negative stride is specified and the starting or stopping indices are omitted, they default to ``end of axis'' and ``beginning of axis'' respectively. In my case 4 is end of axis and 0 is begining of the axis so a[::-1] should be equivalent to [4:0:-1] but result which I get in both the cases does not validate. Your interpretation is wrong. In your case, 4 is start index, 0 is end index (as obviously shown by the result you get). Step -1 lets you step backwards, but this does not change the fact that the end-index is the second argument of the slice, right? Now, python work with (right-side) half-open intervals, meaning that the second border is excluded (s[0:4] would return abcd). Which means in your case you won't get a[0] in the result. Hope I'm clear... It can be a bit misleading at start but, as it's consistent, once you get used to it all works fine ;-) Thanks for your response but I am still not clear; can you show me the equivalent of [::-1] in terms actually specifying start-index, end-index which gives me reverse of the given arrary. Denis la vita e estrany http://spir.wikidot.com/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor -- Vishwajeet Singh +91-9657702154 | dextrou...@gmail.com | http://singhvishwajeet.com Twitter: http://twitter.com/vishwajeets | LinkedIn: http://www.linkedin.com/in/singhvishwajeet ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Array slices in python with negative step
On Tue, Jan 12, 2010 at 1:16 AM, Alan Gauld alan.ga...@btinternet.comwrote: vishwajeet singh dextrou...@gmail.com wrote Thanks for your response but I am still not clear; can you show me the equivalent of [::-1] in terms actually specifying start-index, end-index which gives me reverse of the given arrary. I don't think you can, you must use the empty value. In theory you could use -1 except of course -1 refers to the 'e'... Its a slight anomoly due to the use of negative indexing. You can do: 'abcde'[0:5] and get the same as [0:] But you cannot put any valid value for x in 'abcde[4 : x :-1] that gets you the full string. You need to use [4::-1] HTH, Thanks Alan and Micheal that surely cleard my doubts. -- Vishwajeet Singh +91-9657702154 | dextrou...@gmail.com | http://singhvishwajeet.com Twitter: http://twitter.com/vishwajeets | LinkedIn: http://www.linkedin.com/in/singhvishwajeet ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Extracting columns from CSV
On Sun, Oct 11, 2009 at 6:10 PM, Utkarsh livingl...@gmail.com wrote: Hello, I have a CSV file, from which I want to extract data. The CSV file is arranged like this: Time, InSec, Open, High, Low, Close, Qty 09:55:17,35717,41.95,41.95,41.95,41.95,105 09:56:03,35763,41.75,41.75,41.75,41.75,20785 09:56:40,35800,41.75,41.75,41.75,41.75,8950 I wanted to extract each column, and put the data in a list, with a list for each column. I'm using the following code to perform this action: Time, InSec, Open, High, Low, Close, Volume = [], [], [], [], [], [], [] thefile = open('somefile.CSV', 'r') linelist = thefile.readline() while linelist != '': b = linelist.split(',') Time.append(b[0]) InSec.append(b[1]) Open.append(b[2]) High.append(b[3]) Low.append(b[4]) Close.append(b[5]) Volume.append(b[6]) linelist = thefile.readline() Is there any other, better and more pythonic way to do this ? you can take a look at csv module http://docs.python.org/library/csv.html ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor -- Vishwajeet Singh +91-9657702154 | dextrou...@gmail.com | http://singhvishwajeet.com Twitter: http://twitter.com/vishwajeets | LinkedIn: http://www.linkedin.com/in/singhvishwajeet ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] python win32 drive mapping help
On Tue, Sep 22, 2009 at 5:38 AM, Vineet Kothari vineet.koth...@gmail.comwrote: Hi Everyone I saw alot of responses for python on this http://python.org mailing list. I thought any python guru might wish to help me with little code to map two network drives on windows systems I have 3computers at different locations in a network A,B,C I want to map c:/temp folder of A to C c:/temp folder of B to C as well do some copying of data and then delete the mapping. I tried using the code given for mapping: import win32net win32net.NetUseAdd(None,1,{'remote':r'\\server\share','local':'K:','password':'XXX' }) but I get this error: C:\Users\Administrator\Desktoppython test.py Traceback (most recent call last): File test.py, line 31, in module import win32wnet ImportError: No module named win32net I just need help in setting up the mapping. I know how to do the copying using shutil please if you can help me with the mapping code. I am very new to python and I need this help for my project at school. I am using python 2.6 I'll be eagerly waiting for your response. Thanks -- Regards, Vineet Kothari http://www.vineetkothari.in - Its NICE 2 be IMPORTANT, but whats more IMPORTANT is 2 be NICE. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor You need python extension installed on your machine to be able to execute the above code; you can get same from http://sourceforge.net/projects/pywin32/ -- Vishwajeet Singh +91-9657702154 | dextrou...@gmail.com | http://singhvishwajeet.com Twitter: http://twitter.com/vishwajeets | LinkedIn: http://www.linkedin.com/in/singhvishwajeet ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] ImportError: cannot import name log
On Thu, Sep 17, 2009 at 8:41 PM, steve st...@lonetwin.net wrote: Hello Vishwajeet, On 09/16/2009 11:21 PM, vishwajeet singh wrote: Hi, Below is the content of __init__.py import sys from django.core.signals import got_request_exception from . import log logger = log._get_logger() def got_request_exception_callback(sender, **kwargs): Logging all unhandled exceptions. type, exception, traceback = sys.exc_info() logger.error(unicode(exception)) got_request_exception.connect(got_request_exception_callback) My question here is that what does *from . import log* doing I can see a module name log in the same folder. The '.' notation is fairly new and also uncommon AFAIK http://docs.python.org/tutorial/modules.html#intra-package-references This import statement is throwing an error ImportError: cannot import name log. The reasons it can't import using this 'from . import' notation would be the same as for any other import errors. Check your PYTHONPATH and paste the entire traceback if it still does not work. cheers, - steve -- random non tech spiel: http://lonetwin.blogspot.com/ tech randomness: http://lonehacks.blogspot.com/ what i'm stumbling into: http://lonetwin.stumbleupon.com/ Thanks steve for your help I was able to fix the probelm. -- Cheers, Vishwajeet http://www.singhvishwajeet.com ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] ImportError: cannot import name log
Hi, Below is the content of __init__.py import sys from django.core.signals import got_request_exception from . import log logger = log._get_logger() def got_request_exception_callback(sender, **kwargs): Logging all unhandled exceptions. type, exception, traceback = sys.exc_info() logger.error(unicode(exception)) got_request_exception.connect(got_request_exception_callback) My question here is that what does *from . import log* doing I can see a module name log in the same folder. This import statement is throwing an error ImportError: cannot import name log. Thanks for all your help -- Cheers, Vishwajeet http://www.singhvishwajeet.com ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] web2py vs django
I had asked this question earlier is django users google group you can find the responses here http://groups.google.co.in/group/django-users/browse_thread/thread/4c8bfa995c93b07b/f12442dd0d7f4fcd?q=#f12442dd0d7f4fcd On Wed, Sep 9, 2009 at 1:01 PM, Stefan Lesicnik ste...@lsd.co.za wrote: Hi guys. I am writing this because i am little confused and wanted a more 'expert' opinion on the two frameworks. I am still quite a python newbie, and not really familiar with all the intricacies of it and the frameworks. I discovered Django as a framework first. I thought it was really great. The tutorials makes sense, i really like the generic views (looks clean, added a filter, sorting works etc). The importing of various modules did confuse me a bit, but I think its something you can learn and work through. A friend asked me if I had tried web2py, and started looking at it. I haven't looked as much as Django, but I also think its due to the fact that Django seemed to have more resources available to learn. The Django book is great. There are many video tutorials showing you how to start and get going. With web2py, i run it, and I actually dont have a clue what to do next...Admittedly I have put more effort so far into learning Django. I have purchased the web2py book, but havent gone through it yet in detail. I plan on using either framework for a project i want to do that will contain a database of computer resources available, have a workflow where a user can request a service, administrator approve it, and the system will automate and build a machine, virtual machine and notify people. If that makes any difference to framework selection... I guess im trying to choose the correct framework before I put alot of effort into a dead horse :) Maybe to summarise what ive found so far (i know there are more, im coming from a newbie perspective here!) Django - Great generic views (sortable, filters etc) - Nice admin interface - Looks professional and clean - May be slightly more complex than web2py - Template specific language. - Feels like more addons and 3rd party support, not sure about this? web2py - Simpler syntax for doing things (This may be a nice factor, but then it does do more 'magic') - Unable to find generic views? - Not sure how to begin - Works with google app engine (not an issue for me, but thats pretty cool) - Template stuff is pure python with no indentation (this is good!) - Interface feels old. LIke pre 2003 way of doing stuff. feels like static html pages. - No importing of modules, all handled for you (this may not be a great thing. I am undecided still...) Thanks everyone, i would really appreciate hearing your views. Stefan ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor -- Cheers, Vishwajeet http://www.singhvishwajeet.com ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Needing Help
You can put your script in pastebin http://python.pastebin.com/ http://python.pastebin.com/I don't think any one will mind you pasting code in mail but pastebin makes it easier to read On Tue, Jun 30, 2009 at 10:36 PM, Bob Rea gapet...@stsams.org wrote: I am jsut beginning to learn python form a book. I have run into a problem running a script from the book. I want to ask for help. Shoudl I put the whole script into my email or put it somewhere on the web for you to look at instead. Not sure how this works, script is 68 lines. -- Bob Rea mailto:gapet...@stsams.org http://www.petard.us http://www.petard.us/blog http://www.petard.us/gallery Where is Bill Stringfellow now that we really need him? ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor -- Cheers, Vishwajeet http://www.singhvishwajeet.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Error installing review board on windows
Yes I am using python 2.5 and I have corect version of PIL for python 2.5. Thanks for your help anyways. On Fri, May 29, 2009 at 2:47 AM, Dave Angel da...@ieee.org wrote: vishwajeet singh wrote: Hi List, I am trying to install review board on windows. It fails saying it could not build PIL 1.1.6 because visual studio was not found on the system and but I have already installed the PIL 1.1.6 using binaries available on the site but review board fails to locate it and every time tries to download the PIL and fails while building the same. error shown below *error: Setup script exited with error: Python was built with Visual Studio 2003;* *extensions must be built with a compiler than can generate compatible binaries. Visual Studio 2003 was not found on this system. If you have Cygwin installed, you can try compiling with MingW32, by passing -c mingw32 to setup.py. *I tried to build the PIL from source using cygwin but that also failed with following error * `_imp___Py_NoneStruct' build\temp.win32-2.5\Release\path.o:path.c:(.text+0xa93): undefined reference to `_imp___Py_NoneStruct' build\temp.win32-2.5\Release\path.o:path.c:(.text+0xac2): undefined reference to `_imp__PyExc_IndexError' build\temp.win32-2.5\Release\path.o:path.c:(.text+0xae5): undefined reference to `_imp__PyExc_TypeError' build\temp.win32-2.5\Release\path.o:path.c:(.text+0xd7c): undefined reference to `_imp___Py_NoneStruct' build\temp.win32-2.5\Release\path.o:path.c:(.text+0xd84): undefined reference to `_imp___Py_NoneStruct' build\temp.win32-2.5\Release\path.o:path.c:(.text+0xe01): undefined reference to `_imp__PyExc_AttributeError' collect2: ld returned 1 exit status error: command 'gcc' failed with exit status 1* Kindly help You don't say just what version of Python you're using, but I'm guessing it's 2.5 You have to use the exact matching version of PIL, the one built for Python 2.5 If you look at http://www.pythonware.com/products/pil/, you can see there are multiple downloads for PIL 1.1.6. They are not interchangeable. This may not be your problem, but it's the first thing I'd check. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor -- Cheers, Vishwajeet http://www.singhvishwajeet.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] Error installing review board on windows
Hi List, I am trying to install review board on windows. It fails saying it could not build PIL 1.1.6 because visual studio was not found on the system and but I have already installed the PIL 1.1.6 using binaries available on the site but review board fails to locate it and every time tries to download the PIL and fails while building the same. error shown below *error: Setup script exited with error: Python was built with Visual Studio 2003;* *extensions must be built with a compiler than can generate compatible binaries. Visual Studio 2003 was not found on this system. If you have Cygwin installed, you can try compiling with MingW32, by passing -c mingw32 to setup.py. *I tried to build the PIL from source using cygwin but that also failed with following error * `_imp___Py_NoneStruct' build\temp.win32-2.5\Release\path.o:path.c:(.text+0xa93): undefined reference to `_imp___Py_NoneStruct' build\temp.win32-2.5\Release\path.o:path.c:(.text+0xac2): undefined reference to `_imp__PyExc_IndexError' build\temp.win32-2.5\Release\path.o:path.c:(.text+0xae5): undefined reference to `_imp__PyExc_TypeError' build\temp.win32-2.5\Release\path.o:path.c:(.text+0xd7c): undefined reference to `_imp___Py_NoneStruct' build\temp.win32-2.5\Release\path.o:path.c:(.text+0xd84): undefined reference to `_imp___Py_NoneStruct' build\temp.win32-2.5\Release\path.o:path.c:(.text+0xe01): undefined reference to `_imp__PyExc_AttributeError' collect2: ld returned 1 exit status error: command 'gcc' failed with exit status 1* Kindly help -- Cheers, Vishwajeet http://www.singhvishwajeet.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Getting file properties on winodws
Hi Tim, My apologies for being vague. Yes you are right I am not able to get any summary property from a image file. Script runs successfully without printing anything. Thanks for your help. On Thu, May 21, 2009 at 1:43 PM, Tim Golden m...@timgolden.me.uk wrote: [Rearranging for reading order] [vishwajeet singh wrote] I am trying to read properties of file on windows like there is a property call Keywords on file; I am to read this property independent of file type. [Tim Golden m...@timgolden.me.uk wrote:] There's an unpolished (indeed, unfinished) example here: http://timgolden.me.uk/python/win32_how_do_i/get-document-summary-info.html [vishwajeet singh wrote:] It does not seems to be working for jpg and in general with image files any pointers on that. It would probably help if you specified what does not seem[s] to be working meant. But I assume that you mean: if you add a Title into the Summary on a JPEG then it doesn't get picked up by the script. What's happening here (I think) is that for media types -- images, movies, etc. -- the [Summary] property sheet is overridden, probably by Windows Media Player which will use the properties embedded in the JPEG (EXIF) or WMV. This isn't Structured Storage as such and so isn't extracted by the script I showed. If I get a chance, I'll look into this a bit further. TJG ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor -- Cheers, Vishwajeet http://www.singhvishwajeet.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] Getting file properties on winodws
Hi, I am trying to read properties of file on windows like there is a property call Keywords on file; I am to read this property independent of file type. I tried using win32api and win32file but I was not able to find any such function; GetFileAttributes gives some limited attributes. -- Cheers, Vishwajeet http://www.singhvishwajeet.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Getting file properties on winodws
Thanks that helped. On Thu, May 21, 2009 at 2:34 AM, Tim Golden m...@timgolden.me.uk wrote: vishwajeet singh wrote: Hi, I am trying to read properties of file on windows like there is a property call Keywords on file; I am to read this property independent of file type. There's an unpolished (indeed, unfinished) example here: http://timgolden.me.uk/python/win32_how_do_i/get-document-summary-info.html TJG ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor -- Cheers, Vishwajeet http://www.singhvishwajeet.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] How to handle complexType returned by wsdl using SOAPpy
Hi, soapUrl = constants.JIRA_PATH + '/jira/rpc/soap/jirasoapservice-v2?wsdl' soap = SOAPpy.WSDL.Proxy(soapUrl) auth = soap.login(constants.JIRA_USERNAME,constants.JIRA_PASSWORD) b = Types.longType(10041L) role = soap.getProjectRole(auth,b) project = soap.getProjectByKey(auth,'TEMP') Now I want to pass role and project object to some other function of the webserice but I get an error as the role and project are of struct type and webservice is expecting remote role and remote project object which is of complexType as mentioned in wsdl. Can anyone tell me how can I handle the complexType and use them? -- Cheers, Vishwajeet http://www.singhvishwajeet.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Webpy vs Django
Thanks for your elaborate reply. On Mon, Apr 20, 2009 at 12:47 AM, Scott SA py...@rscorp.ab.ca wrote: On Apr 19, 2009, at 4:52 AM, vishwajeet singh wrote: This is not to flame any war; I just wanted to know the key features to consider among the two web frame works. What advantage and disadvantages you have when you decide using any one of them. I can't speak with any authority on Webpy (webpy.org), as I have not actually used it though I did read up on its features about a year ago and now just a quick glance again. I do have some experience with a different 'light-weight' framework called Quixote (www.quixote.ca) and have a production project using it... that I'm migrating to Django. I also have a couple of projects using Zope... also being migrated to Django. I don't mention all of this as any indication of prowess, in fact much of the code on these projects has been written by other developers I've contracted to, but that I have some similar experience. The main point I wish to make of all this is that these different frameworks kind of coalesce into sub-groups. They sort-of form into three groups: light-weight framework, full-featured framework and heavy CMS (lots of inseparable overhead). Furthermore, like a series of balls or coins in a simple Pachinko machine (http://en.wikipedia.org/wiki/Pachinko) where each one takes a different route, the application you are developing will have a huge influence on requirements. Personally, I've been working with Django on and off for about 2-1/2 years and find it a joy to work with. It does not have the overhead and hidden 'magic' of Zope and I don't have to re-invent almost everything like Quixote. For _my_ needs, it has been a great blend of capabilities without the oppressing overhead of the CMS. I can add or remove the modules needed on a project-by-project basis. Out of the box, the automated admin interface is a huge time-saver and its object-relational model is quite good at wrapping relational databases into a python-friendly framework. Also it's user-admin and authentication takes care of the core of most sites I work on. It has a good blend for my requirements of granular framework access and functional tools to save me time. And now, there is quite a nice selection of add-on applications that extend Django in a very modular fashion, though there are still growing pains. Like Goldie Locks and the three bears, this one is just right for my needs. Just as Zope is overkill for projects that don't need CMS, Django would be overkill for a project that didn't need much for database access and admin interface. The authors of Django, try pretty hard to not hide anything that is going on in the background but there is still a lot being done for the developer. For example in creating db schemas, wrapping queries and result-sets into object calls, rendering content through templates and much more. All have ways of being modified but not necessarily by novice python developers. So the short answer to your question is that Webpy and Django are quite different in their tool-sets and are therefore tough to compare. As with all lightweight frameworks, they are _shorter_ on pre-defined features. That's not a negative, that _is_ the point of them. Django has tried to bridge, and in my opinion done a good job of it, a lighter-weight core with a well documented and developer-friendly interface for extension. It is a framework that has allowed me to gradually dig deeper and deeper into its workings to extract more advanced features while not bogging me down with redundant and tedious things like forms and user authentication. I chose Django because it had the most to offer for what I need and it seems to have the legs to cover a lot of ground. That said, I don't that anyone could say you were wrong by choosing either of the projects you mentioned given appropriate circumstances (though personally, I can't find _any_ circumstances where I'd recommend Zope today -- but that's probably a personal bias and I won't digress). I know this doesn't answer your question directly but I hope it helps broaden the perspective a little, Scott ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor -- Cheers, Vishwajeet http://www.singhvishwajeet.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Webpy vs Django
Thanks for your answer but can you give me reasons for same. On Tue, Apr 21, 2009 at 2:38 AM, Tim Michelsen timmichel...@gmx-topmail.dewrote: I can recommend you web2py: http://www.web2py.com/ It has been designed for didactical needs and has a low learning curve. Look at the manual extarct for an idea: Free manual chapters - http://mdp.cti.depaul.edu/examples/static/web2py_manual_cut.pdf or check the docs: http://www.web2py.com/examples/default/docs All the best, Timmie ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor -- Cheers, Vishwajeet http://www.singhvishwajeet.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] Webpy vs Django
Hi All, This is not to flame any war; I just wanted to know the key features to consider among the two web frame works. What advantage and disadvantages you have when you decide using any one of them. Thanks for your help -- Cheers, Vishwajeet http://www.singhvishwajeet.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] print output
try this print str(counter) + \n + str(miles) + \n+ name On Thu, Apr 16, 2009 at 11:24 PM, mbikinyi brat mbikinyi_b...@yahoo.comwrote: ** *Dear ALL,* I have defined variables as below and when I call them using the print function, I have something discontinous as in pink colour. How do I call it so that my output should be as in blue * counter=101 miles=1000 name=joe * print counter 101 print miles 1000 print name joe What I want:(Output) 101 1000 joe Regards, Henry ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor -- Cheers, Vishwajeet http://www.singhvishwajeet.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] calculate area of a circle
you need import math On Wed, Apr 15, 2009 at 2:22 PM, mbikinyi brat mbikinyi_b...@yahoo.comwrote: Hi All, This is a code I have written to calculate the area of a circle. *def area(radius): temp=math.pi*radius**2 return temp* ** *I* now call it by entering *area(12)* at the prompt in IDLE. This is the error message I get. Can someone help please? *Traceback (most recent call last): File pyshell#22, line 1, in module area(10) File pyshell#21, line 2, in area temp=math.pi*radius**2 NameError: global name 'math' is not defined* ** Regards, Henry ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor -- Cheers, Vishwajeet http://www.singhvishwajeet.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] python books
Take a look at Useless python http://www.uselesspython.com/ On Tue, Apr 14, 2009 at 10:37 AM, sudhanshu gautam sudhanshu9...@gmail.comwrote: I am new in python , so need a good books , previously read python Bible and swaroop but not satisfied . so tell me good books in pdf format those contents good problems also ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor -- Cheers, Vishwajeet http://www.singhvishwajeet.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Yet another Python book
awesome; I really like the Jython part :) Thanks for your efforts. On Sat, Apr 11, 2009 at 9:31 PM, pyt...@bdurham.com wrote: Dave, Great stuff!!! Thanks for sharing your hard work with the community! Malcolm ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor -- Cheers, Vishwajeet http://www.singhvishwajeet.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] Excel addin in Python
Dear All, I have created an excel addin in python; everything is working pretty fine when I execute the python file, addin is getting added and I am able to use it fine. But I want to distribute this addin to users so I used py2exe to convert it in to an exe so far so good I am able to create exe but when I run this exe it works fine and say registering excel addin but I am not able to see the addin in excel but the entry in registry is present. Any pointers on what may be going wrong?? -- Cheers, Vishwajeet http://www.singhvishwajeet.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Question regarding win32com getting ldap object
Thanks for the help. It worked for me. On Tue, Jan 6, 2009 at 1:28 AM, Jervis Whitley jervi...@gmail.com wrote: On Mon, Jan 5, 2009 at 8:04 PM, vishwajeet singh dextrou...@gmail.comwrote: Hi List, I am running following code to get ldap com object but the result I am getting is unknown I am using Python 25 and win32 bindings available at http://downloads.sourceforge.net/pywin32/pywin32-212.win32-py2.2.exe?modtime=1217535908big_mirror=0 *adsi = win32com.client.Dispatch('ADsNameSpaces') print adsi ldap = adsi.getobject('', 'LDAP:') print ldap* OutPut: COMObject ADsNameSpaces COMObject unknown Any ideas what I am doing wrong ? -- Cheers, Vishwajeet http://www.singhvishwajeet.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor Hi, try the following from the archive: http://mail.python.org/pipermail/python-list/1999-December/018594.html Cheers, Jervis -- Cheers, Vishwajeet http://www.singhvishwajeet.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Providing Solutions for all the Common Questions
That seems to be nice idea. we can look into mailing archives and pick problems from there. Congratulations and thanks for nice initiative. keep the good work On Tue, Oct 21, 2008 at 10:06 AM, Calvin Spealman [EMAIL PROTECTED]wrote: There was a discussion in the #python channel over at freenode about the common questions we seem to field daily. These often revolve around problems a lot of people need solutions for, and for which we have specific answers to we always give. A lot of times this leads to teeth grinding as we try to convince people about our advice. Why else are they asking if they then argue with the answers they get? This takes a lot of time and energy, so a number of us are starting a project to produce tutorials, guides, and explanations to back up a lot of these solutions. For example, a lot of people look to write an irc bot when they learn Python, and often they either plan or are suggested to use Twisted. A tutorial specifically for this need is being written. We've decided to come here to organize this, as it seems to fit. So there are some organizational issues to approach. I thought AppEngine would be a good place to host everything, so I've already registered pythonguides.appspot.com and plan to throw up a basic Wiki to start. Going forward there are some things I want to implement there to support our specific needs. For now, its just a free host. One other initial need is to collect the problems we need to provide our solutions for. So, what do we people ask over and over? -- Read my blog! I depend on your acceptance of my opinion! I am interesting! http://techblog.ironfroggy.com/ Follow me if you're into that sort of thing: http://www.twitter.com/ironfroggy ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor -- Cheers, Vishwajeet http://www.singhvishwajeet.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Exhaustive Enumeration
Thanks for the link it's really useful :) On Mon, Sep 22, 2008 at 2:10 AM, Robert Berman [EMAIL PROTECTED]wrote: That it is. Jaggo wrote: Lol. And here I said to myself only, What a nice challenge. On Sun, Sep 21, 2008 at 10:28 PM, Robert Berman [EMAIL PROTECTED]wrote: A very interesting problem. Given this is homework, I am not sure what it is you want. Do you want the solution coded and tested? Do you want this to include two or three algorithms optimized for speed as well as accuracy? I think the problem is well enough defined so that you do not need any clarification of what it is your professor wants from you. If you would like some help finding a solution set, perhaps you would consider submitting some of your own solutions and commentary as to where your ideas are breaking down. Then, probably, a number of people will jump in to help you. Robert [EMAIL PROTECTED] wrote: This is from the MIT Opencourseware intro to computer science course, which I've been working my way through. I understand what needs to be done (I think), which is basically to test each possibility and return the list of states with the most electoral votes that can be paid for under the campaign budget. I am just at a loss as to how to do it, and I've been thinking about it all weekend. Here is the problem I am referring to. One assumption is that every $1 of money spent in a state translates into a popular vote. Many thanks for any suggestions. Also, the next part of the question asks to do the same thing using Branch and Bound, which I also anticipate having trouble with. If I haven't described things sufficiently, the complete problem is available at: http://ocw.mit.edu/OcwWeb/Electrical-Engineering-and-Computer-Science/6-00Fall-2007/Assignments/index.htm, problem 5. Complete and test this function according to her specification below. Note that she was using exhaustive enumeration to compute the result. Your friend assured you that the function needs no more than 5 additional lines of code. # Problem 2: Exhaustive enumeration def finance_campaign_ee(budget, free_states): Takes a budget, in dollars, and a list of available states, as a list of dictionaries. Computes and returns the list of states that maximizes the total number of electoral votes such that these states can be acquired on the budget. Returns an empty list if no states can be acquired. cheap_states=[] for s in free_states: if s['pop'] = budget: cheap_states.append(s) # Base case if len(cheap_states)==0: res_list=[] # Recursive case else: curr_state=cheap_states[0] other_states=cheap_states[1:] inc_states=finance_campaign_ee( budget-curr_state['pop'], other_states) inc_states.append(curr_state) inc_evotes=total_evotes(inc_states) excl_states=finance_campaign_ee( budget, other_states ) excl_evotes=total_evotes(excl_states) # ... your code goes here ... res_list =return res_list ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor -- Cheers, Vishwajeet http://www.singhvishwajeet.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Is there python editor or plugin for a python editor for curly brackets around code blocks?
try typing this on your python shell : *from __future__ import braces* check the output:* SyntaxError: not a chance (pyshell#0, line 1)* On Wed, Aug 13, 2008 at 10:15 AM, xbmuncher [EMAIL PROTECTED] wrote: Yes I think python is great in its simplicity in typing code but not in its absence of curly brackets to surround code blocks. Personally, it helps me visually see the code blocks as well as saves me constant pain when the compiler complains about broken/missing indents in the code.* I think it would be great if there was an editor for python or a plugin for an existing program to be able to use curly brackets { } when defining code blocks, and then maybe with a push of a button it can convert the curly bracket style code that ignores indents to the indent sensitive code that the python compiler wants. *It would save me a lot of headache in the way too many times I'm constantly trying to hunt down indentation problems in code (usually other people's code). I tried getting different editors with auto-identing as it is listed in the recommend python editors in the python website. However, these don't suffice in fixing most indenation problems... They sometimes even make it worse! Even visually a lot of people write their lines like this: def funcName(arg): bla bla bla more content of function if (this == that) do this Simple indentation errors can be a nightmare in determining whether if statements and other code blocks are inside of another code block or not when all that seperates them is a single bad indent, which could be the error you're looking for, or what it that way in the begg! *So if you know of a plugin for a python editor, let me know. :)* Also, another idea is to edit the compiler somehow or create soem kind of process/script that all scripts with teh curly brackets will get removed before being processed... I'd settle for this solution as well if it exists... Im sure I'm not the only one that has contemplated a curly bracket workaround for python before. :) ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor -- Cheers, Vishwajeet http://www.singhvishwajeet.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] What has Editor X got that PyWin32 hasn't?
I use pydev eclipse plugin for python and it saves me alot time. Packages and modules can be maintained pretty well and if error is in some dependent file I dont have to go to that folder to open it eclipse does it for me. Integration with subversion and JIRA also help me to work in a better way. On Wed, Aug 13, 2008 at 1:11 PM, Alan Gauld [EMAIL PROTECTED]wrote: Dick Moores [EMAIL PROTECTED] wrote You've got me wanting to take a look at vim for Windows. I just downloaded the Self-installing executable gvim##.exe which is listed on http://www.vim.org/download.php#pc. Is this the sort of vim you're talking about? Yes that's the one. I'm on v6.3 but I think the latest version is up to 7.x? However I tend not to use the newest features so 6.3 meets my needs. Alan G. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor -- Cheers, Vishwajeet http://www.singhvishwajeet.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Accessing LDAP
I think this can be of some help to you http://tgolden.sc.sabren.com/python/active_directory.html On Mon, Aug 11, 2008 at 5:44 PM, Steven L Smith [EMAIL PROTECTED]wrote: Any ideas how I can pull a list of domain users from an LDAP server and use it programmatically in a Python web application? Thanks! ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor -- Cheers, Vishwajeet http://www.singhvishwajeet.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Accessing LDAP
I have used it and it works pretty well for me.Can you show the code snippet you are trying to execute?? On Mon, Aug 11, 2008 at 6:43 PM, Steven L Smith [EMAIL PROTECTED]wrote: It is indeed an active directory server, but the sysadmin tells me that it is configured to respond to normal ldap queries as well. I tried Tim's module, and it's giving me an operations error when I try to use his code snippet to list users... - Original Message - From: Rudy Schockaert [EMAIL PROTECTED] To: vishwajeet singh [EMAIL PROTECTED] Cc: Steven L Smith [EMAIL PROTECTED], tutor tutor@python.org Sent: Monday, August 11, 2008 9:04:50 AM (GMT-0500) America/New_York Subject: Re: [Tutor] Accessing LDAP If by LDAP server you mean Active Directory, then Tim's active_directory module is certainly the way to go. If you want a more generic LDAP approach, you could give python-ldaphttp://python-ldap.sourceforge.net/download.shtmla try. On Mon, Aug 11, 2008 at 2:17 PM, vishwajeet singh [EMAIL PROTECTED] wrote: I think this can be of some help to you http://tgolden.sc.sabren.com/python/active_directory.html On Mon, Aug 11, 2008 at 5:44 PM, Steven L Smith [EMAIL PROTECTED] wrote: Any ideas how I can pull a list of domain users from an LDAP server and use it programmatically in a Python web application? Thanks! ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor -- Cheers, Vishwajeet http://www.singhvishwajeet.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor -- Cheers, Vishwajeet http://www.singhvishwajeet.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Accessing LDAP
I am not able to reproduce the problem as it works pretty fine at my end. On Mon, Aug 11, 2008 at 6:51 PM, Steven L Smith [EMAIL PROTECTED]wrote: % import active_directory for person in active_directory.search (objectCategory='Person'): Response.Write(person.displayName) % Results in... Python ActiveX Scripting Engine error '80020009' Traceback (most recent call last): File Script Block , line 17, in module for person in active_directory.search (objectCategory='Person'): File C:\Python25\Lib\site-packages\active_directory.py, line 747, in search return root ().search (*args, **kwargs) File C:\Python25\Lib\site-packages\active_directory.py, line 743, in root _ad = AD () File C:\Python25\Lib\site-packages\active_directory.py, line 712, in AD return AD_object (GetObject (LDAP://%s % default_naming_context)) File C:\Python25\Lib\site-packages\win32com\client\__init__.py, line 73, in GetObject return Moniker(Pathname, clsctx) File C:\Python25\Lib\site-packages\win32com\client\__init__.py, line 88, in Moniker moniker, i, bindCtx = pythoncom.MkParseDisplayName(Pathname) COM Error: An operations error occurred. (0x-7ff8dfe0) /metaproject/index.asp, line 121 - Original Message - From: vishwajeet singh [EMAIL PROTECTED] To: Steven L Smith [EMAIL PROTECTED] Cc: tutor tutor@python.org Sent: Monday, August 11, 2008 9:15:38 AM (GMT-0500) America/New_York Subject: Re: [Tutor] Accessing LDAP I have used it and it works pretty well for me.Can you show the code snippet you are trying to execute?? On Mon, Aug 11, 2008 at 6:43 PM, Steven L Smith [EMAIL PROTECTED] wrote: It is indeed an active directory server, but the sysadmin tells me that it is configured to respond to normal ldap queries as well. I tried Tim's module, and it's giving me an operations error when I try to use his code snippet to list users... - Original Message - From: Rudy Schockaert [EMAIL PROTECTED] To: vishwajeet singh [EMAIL PROTECTED] Cc: Steven L Smith [EMAIL PROTECTED], tutor tutor@python.org Sent: Monday, August 11, 2008 9:04:50 AM (GMT-0500) America/New_York Subject: Re: [Tutor] Accessing LDAP If by LDAP server you mean Active Directory, then Tim's active_directory module is certainly the way to go. If you want a more generic LDAP approach, you could give python-ldaphttp://python-ldap.sourceforge.net/download.shtmla try. On Mon, Aug 11, 2008 at 2:17 PM, vishwajeet singh [EMAIL PROTECTED] wrote: I think this can be of some help to you http://tgolden.sc.sabren.com/python/active_directory.html On Mon, Aug 11, 2008 at 5:44 PM, Steven L Smith [EMAIL PROTECTED] wrote: Any ideas how I can pull a list of domain users from an LDAP server and use it programmatically in a Python web application? Thanks! ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor -- Cheers, Vishwajeet http://www.singhvishwajeet.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor -- Cheers, Vishwajeet http://www.singhvishwajeet.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor -- Cheers, Vishwajeet http://www.singhvishwajeet.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] Element tree: Not giving processing instruction
Hi List, I am trying to use element tree for processing xml and xml has applied xsl on top of it but when I read this file using element tree how I can get the xsl instruction as element tree gives values from root that is first node. Regards, Vishwajeet ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] %(value1, value2) what does this returns
Hi List, def __request(symbol, stat): url = 'http://finance.yahoo.com/d/quotes.csv?s=%sf=%s' % (symbol, stat) return urllib.urlopen(url) I want to know in this % (symbol, stat) returns thanks for help Regards, Vishwajeet ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] %(value1, value2) what does this returns
thanks to all of you for your responses; On Wed, Jul 23, 2008 at 12:18 AM, Michiel Overtoom [EMAIL PROTECTED] wrote: Vishwajeet wrote... I want to know in this % (symbol, stat) returns In itself it returns nothing. The '%' is used as the 'string interpolation operator' here. http://docs.python.org/lib/typesseq-strings.html print %d kilos of %s for %f euro % (2,mangos,3.75) 2 kilos of mangos for 3.75 euro Greetings, -- The ability of the OSS process to collect and harness the collective IQ of thousands of individuals across the Internet is simply amazing. - Vinod Vallopillil http://www.catb.org/~esr/halloween/halloween4.htmlhttp://www.catb.org/%7Eesr/halloween/halloween4.html ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor