Re: [Tutor] ssh connection

2012-12-18 Thread Ufuk Eskici
I have Putty and I it runs from CMD successfully. *C:\Users\eufuesk>*"c:\Program Files\Putty\putty.exe" -ssh [username]@ 10.0.0.1 -pw [password] But I dont know how to send this command from Pyhton. :( 2012/12/17 Prasad, Ramit > Please always include the list in your response (I have CC-ed t

Re: [Tutor] Get the structure values from a c file

2012-12-18 Thread Dave Angel
On 12/17/2012 11:25 PM, Marefe Serentas wrote: > On 12/18/2012 12:38 AM, tutor-requ...@python.org wrote: >> Re: Get the structure values from a c file > I apologize for some syntax errors in my c file. I would like to correct > my mistakes and append some lines in the c file to make it clearer. > >

Re: [Tutor] ssh connection

2012-12-18 Thread Alan Gauld
On 18/12/12 08:03, Ufuk Eskici wrote: I have Putty and I it runs from CMD successfully. *C:\Users\eufuesk>*"c:\Program Files\Putty\putty.exe" -ssh [username]@10.0.0.1 -pw [password] But I dont know how to send this command from Pyhton. :( Have you read the subprocess modul

Re: [Tutor] Get the structure values from a c file

2012-12-18 Thread Alan Gauld
On 18/12/12 04:25, Marefe Serentas wrote: int some_data[] = { -288, -153, 31, 24,205,110, 39, 88, -281,145, 35,266, 63,-79, -103,-25, 53,145, -114, -274, 46, 60,220,205 }; typedef struct MainStruct {

Re: [Tutor] Tutor Digest, Vol 106, Issue 42

2012-12-18 Thread Alan Gauld
On 18/12/12 07:56, Peter Otten wrote: myMain. The c file input content might change in the future like different values assigned, added fields in the MainStruct, etc. Also I am not permitted to change the c file. How about running the C source with an added dump() function That would have b

Re: [Tutor] ssh connection

2012-12-18 Thread शंतनू
On 18/12/12 7:51 PM, Alan Gauld wrote: > On 18/12/12 08:03, Ufuk Eskici wrote: >> I have Putty and I it runs from CMD successfully. >> >> *C:\Users\eufuesk>*"c:\Program Files\Putty\putty.exe" -ssh >> [username]@10.0.0.1 >> -pw [password] >> >> But I dont know how to send this c

Re: [Tutor] ssh connection

2012-12-18 Thread Alan Gauld
On 18/12/12 09:26, शंतनू wrote: You may also like to have a look at 'commands' module, especially when no user input is required. I agree commands is easy to use but it is deprecated in favour of subprocess. And I suspect in this case the use will be interactive. -- Alan G Author of the Le

Re: [Tutor] Tutor Digest, Vol 106, Issue 42

2012-12-18 Thread Peter Otten
Alan Gauld wrote: > On 18/12/12 07:56, Peter Otten wrote: > >>> myMain. The c file input content might change in the future like >>> different values assigned, added fields in the MainStruct, etc. Also I >>> am not permitted to change the c file. >>> >> How about running the C source with an adde

[Tutor] sys.getfilesystemencoding()

2012-12-18 Thread Albert-Jan Roskam
Hi,   I am trying to write a file with a 'foreign' unicode name (I am aware that this is a highly western-o-centric way of putting it). In Linux, I can encode it to utf-8 and the file name is displayed correctly. In windows xp, the characters can, apparently, not be represented in this encoding

Re: [Tutor] sys.getfilesystemencoding()

2012-12-18 Thread Peter Otten
Albert-Jan Roskam wrote: > I am trying to write a file with a 'foreign' unicode name (I am aware that > this is a highly western-o-centric way of putting it). In Linux, I can > encode it to utf-8 and the file name is displayed correctly. In windows > xp, the characters can, apparently, not be repr

Re: [Tutor] sys.getfilesystemencoding()

2012-12-18 Thread eryksun
On Tue, Dec 18, 2012 at 8:13 AM, Albert-Jan Roskam wrote: > > # Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) > [MSC v.1500 32 bit (Intel)] on win32 > > import sys > > def _encodeFileName(fn): > """Helper function to encode unicode file names into system file names. > http://effbot.or

Re: [Tutor] sys.getfilesystemencoding()

2012-12-18 Thread Oscar Benjamin
On 18 December 2012 13:13, Albert-Jan Roskam wrote: > I am trying to write a file with a 'foreign' unicode name (I am aware that > this is a highly western-o-centric way of putting it). In Linux, I can encode > it to utf-8 and the file name is displayed correctly. In windows xp, the > character

Re: [Tutor] sys.getfilesystemencoding()

2012-12-18 Thread Albert-Jan Roskam
- Original Message - > From: eryksun > To: Albert-Jan Roskam > Cc: Python Mailing List > Sent: Tuesday, December 18, 2012 2:52 PM > Subject: Re: [Tutor] sys.getfilesystemencoding() > > On Tue, Dec 18, 2012 at 8:13 AM, Albert-Jan Roskam > wrote: >> >> # Python 2.6.4 (r264:75708, Oct 2

Re: [Tutor] sys.getfilesystemencoding()

2012-12-18 Thread eryksun
On Tue, Dec 18, 2012 at 8:13 AM, Albert-Jan Roskam wrote: > >In windows xp, the characters can, apparently, not be represented >in this encoding called 'mbcs'. MBCS (multibyte character set) refers to the locale encoding on Windows. CPython encodes to MBCS via the Win32 function WideCharToMultiBy

[Tutor] optparse.OptionParser options in alphabetical order in help display

2012-12-18 Thread rail shafigulin
Does anybody know if there is a way to make --help option to display options in alphabetical order? Right now it displays options in the order I added them. I'm using Python 3.1 Any help is appreciated. Thanks. ___ Tutor maillist - Tutor@python.org To

Re: [Tutor] optparse.OptionParser options in alphabetical order in help display

2012-12-18 Thread Steve Willoughby
Although it is probably too obvious to be the answer you're looking for, why can't you just add them in order in the source code? This way, you can arrange them however you want them to appear, instead of python arbitrarily enforcing its own order. Python likes being explicit about things like

Re: [Tutor] optparse.OptionParser options in alphabetical order in help display

2012-12-18 Thread Modulok
>> Does anybody know if there is a way to make --help option to display >> options in alphabetical order? I know this sounds like spam and doesn't answer your question, (sorry!) but you should check out the third part module 'docopt'. It is *extremely* simple and a lot more flexible. It made me ac

Re: [Tutor] Image Processing

2012-12-18 Thread Prasad, Ramit
Ashkan Rahmani wrote: > > I have developed some simple c++/qt/opencv application with face > detection functionality. > for some reasons I'm going to start again them and I wan to use python 3. > Unfortunately I found opencv not supported in python 3. > 1- as I'm new in python programming, is pyth

Re: [Tutor] optparse.OptionParser options in alphabetical order in help display

2012-12-18 Thread rail shafigulin
On Tue, Dec 18, 2012 at 1:39 PM, Modulok wrote: > >> Does anybody know if there is a way to make --help option to display > >> options in alphabetical order? > > I know this sounds like spam and doesn't answer your question, (sorry!) > but you > should check out the third part module 'docopt'. It

Re: [Tutor] optparse.OptionParser options in alphabetical order in help display

2012-12-18 Thread rail shafigulin
On Tue, Dec 18, 2012 at 1:08 PM, Steve Willoughby wrote: > Although it is probably too obvious to be the answer you're looking for, > why can't you just add them in order in the source code? > > This way, you can arrange them however you want them to appear, instead of > python arbitrarily enforc

[Tutor] I cant fix this bug

2012-12-18 Thread Gina
I have Python version 3. when the program begins, it prints out the main menu and then asks you for your choice - just like it is supposed to you enter your choice, and the next menu pops up, and below the menu it says "None" on the line before your next choice is asked for i dont know why it d

Re: [Tutor] I cant fix this bug

2012-12-18 Thread Oscar Benjamin
On 19 December 2012 01:05, Gina wrote: > I have Python version 3. > when the program begins, it prints out the main menu and then asks you for > your choice - just like it is supposed to > you enter your choice, and the next menu pops up, and below the menu it says > "None" on the line before your

Re: [Tutor] I cant fix this bug

2012-12-18 Thread Mitya Sirenef
On 12/18/2012 08:05 PM, Gina wrote: I have Python version 3. when the program begins, it prints out the main menu and then asks you for your choice - just like it is supposed to you enter your choice, and the next menu pops up, and below the menu it says "None" on the line before your next choi

Re: [Tutor] optparse.OptionParser options in alphabetical order in help display

2012-12-18 Thread Steven D'Aprano
On 19/12/12 07:39, rail shafigulin wrote: I currently have it done this way. It just seems a bit odd that I have to arrange it manually. What's so special about alphabetical order? Wouldn't it make more sense for related options to be kept together? E.g.: Usage: make_sandwich [OPTIONS] --

Re: [Tutor] I cant fix this bug

2012-12-18 Thread bob gailer
On 12/18/2012 8:05 PM, Gina wrote: print(menu_quad()) menu_quad() calls that function which prints the quadrilateral menu. The function has no return statement, so by default it returns None. The above print then prints None. Change menu_quad() to return rather than print the menu. BTW you r

Re: [Tutor] optparse.OptionParser options in alphabetical order in help display

2012-12-18 Thread rail shafigulin
On Tue, Dec 18, 2012 at 8:13 PM, Steven D'Aprano wrote: > On 19/12/12 07:39, rail shafigulin wrote: > > I currently have it done this way. It just seems a bit odd that I have to >> arrange it manually. >> > > What's so special about alphabetical order? Wouldn't it make more sense for > related op

[Tutor] Your thoughts on using Python 2.4.x?

2012-12-18 Thread boB Stepp
At my workplace we have nearly completed the hardware and software upgrades. Up to this point I have been using Perl to write scripts that work with our planning software which has its own proprietary scripting environment. Generally speaking the scripts I write are always text files which run Sola

[Tutor] need help with python for counter

2012-12-18 Thread Brandon Merritt
I feel silly, but I'm having the darndest time trying to figure out why this for counter won't work. I know that there is the count method for the string class, but I was just trying to do it the syntactical way to prove myself that I know the very basics. As of right now, my script is just returni

Re: [Tutor] need help with python for counter

2012-12-18 Thread Mitya Sirenef
On 12/19/2012 12:40 AM, Brandon Merritt wrote: I feel silly, but I'm having the darndest time trying to figure out why this for counter won't work. I know that there is the count method for the string class, but I was just trying to do it the syntactical way to prove myself that I know the very

Re: [Tutor] need help with python for counter

2012-12-18 Thread DoanVietTrungAtGmail
After incrementing for a little while, if the condition i == digit is not met for the current character, count is reset by the else: branch. Your count variable must feel frustrated like a dog which keeps being yanked back by a cord of length 0 when it tries to get free. Trung Doan == On

[Tutor] still confused about for loops

2012-12-18 Thread Brandon Merritt
Sorry, I am just so confused and aggravated as to why this won't work - why doesn't it print out the whole list? : number = raw_input('Enter a 7-unit number: ') for i in number: count = [] count.append(i) print count >>> Enter a 7-unit number: 78953298 ['8'] -- *Brandon Merritt** (707

[Tutor] How can I overwrite the previous version on linux ?

2012-12-18 Thread Dae James
My linux distribution is CentOs 6.3. And python attached to the OS is 2.6. How can I overwrite the previous version with python 2.7 ? Or how can I uninstall the previous version? Dae James___ Tutor maillist - Tutor@python.org To unsubscribe or cha

Re: [Tutor] still confused about for loops

2012-12-18 Thread Mitya Sirenef
On 12/19/2012 01:19 AM, Brandon Merritt wrote: Sorry, I am just so confused and aggravated as to why this won't work - why doesn't it print out the whole list? : number = raw_input('Enter a 7-unit number: ') for i in number: count = [] count.append(i) print count >>> Enter a 7-unit n

Re: [Tutor] need help with python for counter

2012-12-18 Thread शंतनू
On 19/12/12 5:12 PM, Mitya Sirenef wrote: > You can also do: > > count = sum(i==digit for i in number) > > I think this is very clear and short.. Another... import re count = len(re.findall(digit, number)) -- shantanoo ___ Tutor maillist - Tutor@py