Syntax suggestion.
Saluton! Being a fond of Python, I had this idea: Why not making Python a Unix shell? But, after a little thinking, i found that the current syntax may be troublesome. For example: to list files in bash I'll do $ ls M* When for Python it will be: >>> import UShell >>> UShell.ls("M*") or >>> UShell.exec("ls M*") So, why not making the use of parentheses when a function is one lined optional to have commands like this: >>> UShell.ls "M*" or even >>> ls "M*" Then, why not making the comma optional too when executing such instructions: >>> UShell.echo number result Instead of >>> UShell.echo number,result And finally, why not making the string parameter "-less when it is the only parameter: >>> UShell.ls M* Instead of >>> UShell.ls "M*" Adiaux Samir -- http://mail.python.org/mailman/listinfo/python-list
Re: Syntax suggestion.
Bonan tagon! George Sakkis wrote: > It's been done; it's called "IPython": > http://ipython.scipy.org/doc/manual/manual.html Thank you for the link! It's just what I've needed but... Roberto Bonvallet wrote : > ...so finally you get something that is exactly like any Unix shell, and > completely different to Python. If you want Python to look like bash, work > like bash and have bash-like syntax, you should really consider using bash :) I'm fedup of typing over and over parentheses around function calls every time I call a single ligne function call or when it is inside an "if" statement. So i thought that ommiting the parentheses and, why not, the commas in such cases will be a sort of beautiful/easier :) Adiaux Samir -- http://mail.python.org/mailman/listinfo/python-list
Re: Syntax suggestion.
Saluton! Simon Forman wrote: >But think of all the curly braces around code blocks that you've never had to type! ;-) That's why I left java to jython! Eirikur Hallgrimsson wrote: >This actually exists. >The language which omits punctuation not actually required to resolve ambiguity is called Ruby. >Ruby is subject to a lot of love/hate over this. It's late, now I talk Python HSSSHSSHS HSSHSS HS :) I think that Ruby is a good scripting language for game engines but not as good as Python to do some serious scientific processes (or, at least Ruby doesn't have all the necessary "batteries"). Talking of games, "Blade of Darkness" was scripted entirely in Python (1.5 I think) :) Sybren Stuvel wrote: > But how would you discern between a function reference and a function > call? That would be a problem with two solutions: 1- If the function doesn't have any parameters, it will be called with the empty parentheses (just like usual!); 2- to indicate that this is a function call, we would be adding a $ at the end of the statement. Gxis la reskribo Samir -- http://mail.python.org/mailman/listinfo/python-list
Re: Syntax suggestion.
Alex Martelli wrote: > What a mess it would be to disambiguate statements such as > > x = foo bar baz bat > > is it x = (foo, bar, baz, bat) > or x = foo(bar, baz, bat) > or x = foo(bar(baz), bat) > or x = foo(bar, baz(bat)) > or x = foo(bar(baz, bat)) It will be x=foo(bar,baz,bat). The parenthese ommition would only be valable for the first function call in the statement. > or ... [even ignoring the possibility that one or more of these might be > functions callable without arguments...!!!]... That won''t be a problem: "x=foo bar(baz) bat" would be equivalent to "x=foo(bar(baz),bat)". Or, but least realistic, it would be in the scheme trend. For example: a=b(c,d(e,f(g,h,i,j,k))) <==> a=b c (d e (f g h i j k)) It looks nicer, isn't it? :) > iPython has some heuristics that may be reasonable for the commandline > (and are, in any case, at least simple), but in practice I find that I > go back to using the good old interactive Python interpreter rather than > putting up with even those simple heuristics. That depends of your need to such tools. For example if you need to copy a file, then, resolve a linear system then chroot and set the password as de hexadecimal representation of the hash function of pi multiplied by the averge of the solution coordinations +_+, you'll need IPython ;) -- http://mail.python.org/mailman/listinfo/python-list
Re: Syntax suggestion.
Saluton! Alex Martelli wrote: > GVIM (and the normal Python interpreter) work better for me: to perform > such a task, I would always write (and run) a script, of course (the > purpose of the chroot step is somewhat mysterious here, btw). If I have > to perform a strange and complex task once, it's likely that I will have > to perform some variant of it again in the future, and having the script > around will make it easy to edit and tweak. Furthermore, having the > script around can be a useful indicator when I'm later trying to > reconstruct exactly what it is that I did. And that's what any concious humain will do in such situation. What I ment is that, sometimes, you have to work in real time and have no time to code->test->debug->... cycle. For example when monitoring or forging some IP packets (you can fake a "fantom" Sun workstation in your home network like that ;) and need a realtime custom check function or when you're using your computer as a "desk scientific calculator" you'd like to have a flexible, powerfull and light-weight-syntax interpretted programming language. That language would be with no doubt Python! But, why not, with lighter syntax. Adiaux! Samir -- http://mail.python.org/mailman/listinfo/python-list
Re: Extracting text from a string + note
Saluton! Tempo wrote: > I am having a little trouble extracting text from a string. The > string that I am dealing with is pasted below, and I want to > extract the prices that are contained in the string below. This string is absolutely an XML chunk. Just use xmllib. Adiaux Samir -- http://mail.python.org/mailman/listinfo/python-list
Converting List of String to Integer
Hi Everyone, I am relatively new to Python so please forgive me for what seems like a basic question. Assume that I have a list, a, composed of nested lists with string representations of integers, such that a = [['1', '2'], ['3'], ['4', '5', '6'], ['7', '8', '9', '0']] I would like to convert this to a similar list, b, where the values are represented by integers, such as b = [[1, 2], [3], [4, 5, 6], [7, 8, 9, 0]] I have unsuccessfully tried the following code: n = [] for k in a: n.append([int(v) for v in k]) print n Does anyone know what I am doing wrong? Thanks in advance. Samir -- http://mail.python.org/mailman/listinfo/python-list
Re: Converting List of String to Integer
On Jul 21, 3:20 pm, Gary Herron <[EMAIL PROTECTED]> wrote: > Samir wrote: > > Hi Everyone, > > > I am relatively new to Python so please forgive me for what seems like > > a basic question. > > > Assume that I have a list, a, composed of nested lists with string > > representations of integers, such that > > > a = [['1', '2'], ['3'], ['4', '5', '6'], ['7', '8', '9', '0']] > > > I would like to convert this to a similar list, b, where the values > > are represented by integers, such as > > > b = [[1, 2], [3], [4, 5, 6], [7, 8, 9, 0]] > > > I have unsuccessfully tried the following code: > > > n = [] > > for k in a: > > n.append([int(v) for v in k]) > > print n > > > Does anyone know what I am doing wrong? > > > Thanks in advance. > > > Samir > > -- > >http://mail.python.org/mailman/listinfo/python-list > > You didn't tell us how it failed for you, so I can't guess what's wrong. > > However, your code works for me: > > >>> a = [['1', '2'], ['3'], ['4', '5', '6'], ['7', '8', '9', '0']] > >>> n = [] > >>> for k in a: > ... n.append([int(v) for v in k]) > ... > >>> print n > [[1, 2], [3], [4, 5, 6], [7, 8, 9, 0]] > > (Although you seem to have confused variables b and n.) > > Gary Herron- Hide quoted text - > > - Show quoted text - Hi Gary, Thanks for your quick response (and sorry about mixing up b and n). For some reason, the logic I posted seems to work ok while I'm using the Python shell, but when used in my code, the program just hangs. It never outputs the results. Below is the code in its entirety. Is there a problem with my indendentation? a = n = [] t = """ 1 2 3 4 5 6 7 8 9 0 """ d = t.split("\n") for x in range(1,len(d)-1): a.append(d[x].split(" ")) print a for k in a: n.append([int(v) for v in k]) print n Thanks again. Samir -- http://mail.python.org/mailman/listinfo/python-list
Re: Converting List of String to Integer
On Jul 21, 4:44 pm, Gary Herron <[EMAIL PROTECTED]> wrote: > Samir wrote: > > On Jul 21, 3:20 pm, Gary Herron <[EMAIL PROTECTED]> wrote: > > >> Samir wrote: > > >>> Hi Everyone, > > >>> I am relatively new to Python so please forgive me for what seems like > >>> a basic question. > > >>> Assume that I have a list, a, composed of nested lists with string > >>> representations of integers, such that > > >>> a = [['1', '2'], ['3'], ['4', '5', '6'], ['7', '8', '9', '0']] > > >>> I would like to convert this to a similar list, b, where the values > >>> are represented by integers, such as > > >>> b = [[1, 2], [3], [4, 5, 6], [7, 8, 9, 0]] > > >>> I have unsuccessfully tried the following code: > > >>> n = [] > >>> for k in a: > >>> n.append([int(v) for v in k]) > >>> print n > > >>> Does anyone know what I am doing wrong? > > >>> Thanks in advance. > > >>> Samir > >>> -- > >>>http://mail.python.org/mailman/listinfo/python-list > > >> You didn't tell us how it failed for you, so I can't guess what's wrong. > > >> However, your code works for me: > > >> >>> a = [['1', '2'], ['3'], ['4', '5', '6'], ['7', '8', '9', '0']] > >> >>> n = [] > >> >>> for k in a: > >> ... n.append([int(v) for v in k]) > >> ... > >> >>> print n > >> [[1, 2], [3], [4, 5, 6], [7, 8, 9, 0]] > > >> (Although you seem to have confused variables b and n.) > > >> Gary Herron- Hide quoted text - > > >> - Show quoted text - > > > Hi Gary, > > > Thanks for your quick response (and sorry about mixing up b and n). > > For some reason, the logic I posted seems to work ok while I'm using > > the Python shell, but when used in my code, the program just hangs. > > It never outputs the results. Below is the code in its entirety. Is > > there a problem with my indendentation? > > Aha. There's the problem, right there in the first line. > > > a = n = [] > > This sets a and n to the *same* empty list. This line creates one > empty list and binds both n and a to that list. Note carefully, there > is only one empty list here, but it can be accessed under two names > > Later in your code, > > for k in a: > > runs through that list, and > > n.append(...) > > append to the end of the same list. Thus the loop never get to the end of > the (continually growing) list. > > Solve it by creating two different empty lists: > > a = [] > n = [] > > Gary Herron > > > > > t = """ > > 1 2 > > 3 > > 4 5 6 > > 7 8 9 0 > > """ > > > d = t.split("\n") > > > for x in range(1,len(d)-1): > > a.append(d[x].split(" ")) > > print a > > > for k in a: > > n.append([int(v) for v in k]) > > > print n > > > Thanks again. > > > Samir > > -- > >http://mail.python.org/mailman/listinfo/python-list- Hide quoted text - > > - Show quoted text -- Hide quoted text - > > - Show quoted text - Gary, That did the trick! I didn't realize that the way I initialized my lists would lead to the behavior that I observed. After doing something similar to what John had suggested I did indeed discover that I created an endless loop. I'm glad I learned something today. Thanks for your help. Samir -- http://mail.python.org/mailman/listinfo/python-list
Re: Converting List of String to Integer
On Jul 21, 6:15 pm, Andrew Freeman <[EMAIL PROTECTED]> wrote: > Samir wrote: > > On Jul 21, 3:20 pm, Gary Herron <[EMAIL PROTECTED]> wrote: > > >> Samir wrote: > > >>> Hi Everyone, > > >>> I am relatively new to Python so please forgive me for what seems like > >>> a basic question. > > >>> Assume that I have a list, a, composed of nested lists with string > >>> representations of integers, such that > > >>> a = [['1', '2'], ['3'], ['4', '5', '6'], ['7', '8', '9', '0']] > > >>> I would like to convert this to a similar list, b, where the values > >>> are represented by integers, such as > > >>> b = [[1, 2], [3], [4, 5, 6], [7, 8, 9, 0]] > > >>> I have unsuccessfully tried the following code: > > >>> n = [] > >>> for k in a: > >>> n.append([int(v) for v in k]) > >>> print n > > >>> Does anyone know what I am doing wrong? > > >>> Thanks in advance. > > >>> Samir > >>> -- > >>>http://mail.python.org/mailman/listinfo/python-list > > >> You didn't tell us how it failed for you, so I can't guess what's wrong. > > >> However, your code works for me: > > >> >>> a = [['1', '2'], ['3'], ['4', '5', '6'], ['7', '8', '9', '0']] > >> >>> n = [] > >> >>> for k in a: > >> ... n.append([int(v) for v in k]) > >> ... > >> >>> print n > >> [[1, 2], [3], [4, 5, 6], [7, 8, 9, 0]] > > >> (Although you seem to have confused variables b and n.) > > >> Gary Herron- Hide quoted text - > > >> - Show quoted text - > > > Hi Gary, > > > Thanks for your quick response (and sorry about mixing up b and n). > > For some reason, the logic I posted seems to work ok while I'm using > > the Python shell, but when used in my code, the program just hangs. > > It never outputs the results. Below is the code in its entirety. Is > > there a problem with my indendentation? > > > a = n = [] > > t = """ > > 1 2 > > 3 > > 4 5 6 > > 7 8 9 0 > > """ > > > d = t.split("\n") > > > for x in range(1,len(d)-1): > > a.append(d[x].split(" ")) > > print a > > > for k in a: > > n.append([int(v) for v in k]) > > > print n > > > Thanks again. > > > Samir > > -- > >http://mail.python.org/mailman/listinfo/python-list > > I think this will work better, a sub-list comprehension of sorts: > n = [[int(i) for i in k] for k in a] > > here is an ipython interactive session using it: > In [1]: a = n = [] > > In [2]: t = """ > ...: 1 2 > ...: 3 > ...: 4 5 6 > ...: 7 8 9 0 > ...: """ > > In [3]: > > In [4]: d = t.split("\n") > > In [5]: for x in range(1,len(d)-1): > ...: a.append(d[x].split(" ")) > ...: > ...: > > In [6]: a > Out[6]: [['1', '2'], ['3'], ['4', '5', '6'], ['7', '8', '9', '0']] > > In [7]: n = [[int(i) for i in k] for k in a] > > In [8]: n > Out[8]: [[1, 2], [3], [4, 5, 6], [7, 8, 9, 0]] > -- > Andrew- Hide quoted text - > > - Show quoted text - Andrew, Thanks for the tip, though the syntax makes my head spin a bit in trying to comprehend it. For my small list, I didn't notice a discernible increase in speed, but I may have to try it with a larger list size. Incidentally, I had never heard of iPython but from their web site, it looks like an interesting tool. I'll have to check it out. Thanks. Samir -- http://mail.python.org/mailman/listinfo/python-list
Re: Converting List of String to Integer
Wow! Thanks for all of the great additional feedback and responses since I last checked in. The help this group provides is amazing. I'm glad I found it. @Andrew -- Thanks for the clarification on the nested for loop and how to intrepret it. Also, thanks for the information on generators. I have never come across this before so I will look into it a bit more. The same thing goes for iPython. I have been looking for an IDE that comes with better debugging capabilities that the default Python shell. @dusans -- Just when I thought I couldn't simplify my code anymore, you provide come up with another way. Thank you. @ptn -- Thanks for the explanation between "append" and "extend". I guess I've gotten lazy and have always used "append", apparently even in situations where it may not be appropriate. Thanks again, everyone! Samir -- http://mail.python.org/mailman/listinfo/python-list
Iterating Through List or Tuple
Is there a way to loop or iterate through a list/tuple in such a way that when you reach the end, you start over at the beginning? For example, suppose I define a list "daysOfWeek" such that: >>> daysOfWeek = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', >>> 'friday', 'saturday'] If today is Sunday, I can set the variable "day" to today by: >>> i = iter(daysOfWeek) >>> day = i.next() >>> print day sunday If I want to find out the day of the week 2 days from now, then this code works ok: >>> for x in xrange(2): day = i.next() >>> print day tuesday However, when extending my range beyond the number of items in the list, I receive an error. For example, if I want to find out the day of the week 11 days from today, I get this: >>> for x in xrange(11): day = i.next() Traceback (most recent call last): File "", line 1, in for x in xrange(11): day = i.next() StopIteration Is there a way to easily loop through a list or tuple (and starting over at the beginning when reaching the end) without having to resort to an "if" or "while" statement? (My question concerns the more general use of lists and tuples, not necessarily determining days of the week. I know about using "import datetime" and "from calendar import weekday" but thought that using the days of the week would best illustrate my problem.) As always, thanks in advance. Samir -- http://mail.python.org/mailman/listinfo/python-list
Re: Iterating Through List or Tuple
Fredrik, Marc, Larry -- Thank you all for your very fast and informative replies. I had not come across "itertools" in my search. This group is a great resource. Samir -- http://mail.python.org/mailman/listinfo/python-list
Request Help Debugging Program
Hi Everyone, In order to get a better command of Python, I have been trying to solve the puzzles on the Project Euler web site. I've made my way down to problem 21: http://projecteuler.net/index.php?section=problems&id=21 I've created a function (findSumOfDivisor), that when passed an integer, will return the sum of the argument's natural divisors. When tested in isolation, it seems to do what I intended. When I incorporate it into the larger program, however, I start getting run-time errors that for the life of me I cannot debug. My brute-force approach is to cycle through all of the integers to find the sum of their divisors and then enter the number (as key) and the sum of the divisors (as values) to a dictionary called "amicable". I only call findSumOfDivisor if the key:value combination does not already exist in the dictionary (hoping to save some time when I loop through 10,000 integers). Below is the code I have so far. I'm not completely certain if my logic will lead me to the correct solution, but that is a different matter. For now, the program seems to get through the first integer, 2, successfully, but errors out in line 20 when it tries to call the function. Apparently, Python doesn't like line 12 in the function where it returns the sum of the divisors. The code, which is best viewed using a fixed-font, is: from math import sqrt def findSumOfDivisor(n): divisor = [1] # start list of divisors at 1 for x in range(2, int(sqrt(n))+1): # search for possible divisors between 2 and sqrt(n) if n%x == 0: # if x is a divisor of n if ((n/x) == x): # and if x is the sqrt of n divisor.append(x) # add x to the list of divisors else: # otherwise divisor.append(x) # add x to the list of divisors divisor.append(n/x)# and add n/x to the list as well return sum(divisor)# return the sum of the divisors answer = [] # initialize answer to empty amicable = {1:0} # initialize amicable dictionary for 1 (sum is 0) for i in range(2,10): # loop through integers 2 through 9 if not amicable.has_key(i):# if i not found in amicable keys sum = findSumOfDivisor(i) # then find the sum of its divisors amicable[i] = sum # and add both to amicable dictionary else: # otherwise sum = amicable[i] # just get its sum if not amicable.has_key(sum): sum2 = findSumOfDivisor(sum) # if sum of i's divisors not in amicable keys amicable[sum] = sum2 # then add both to amicable dictionary else: # otherwise sum2 = amicable[sum] # just get its sum if i == sum2: # if i is amicable with sum2 answer.append(i) # append i to list of answers answer.append(sum2)# and append sum2 to list of answers print "amicable =", amicable print "answer =", answer The error I receive is: Traceback (most recent call last): File "pe_prob021.py", line 19, in sum = findSumOfDivisor(i) # then find the sum of its divisors File "pe_prob021.py", line 12, in findSumOfDivisor return sum(divisor)# return the sum of the divisors TypeError: 'int' object is not callable Even after cluttering the code with print statements every other line, I am completely lost. Does anyone know why I get this error? Thanks in advance. Samir -- http://mail.python.org/mailman/listinfo/python-list
Re: Request Help Debugging Program
On Jul 23, 9:14 pm, mzdude <[EMAIL PROTECTED]> wrote: > On Jul 23, 6:30 pm, Samir <[EMAIL PROTECTED]> wrote: > > > Hi Everyone, > > > def findSumOfDivisor(n): > > > return sum(divisor) # fine using function sum() > > > sum = findSumOfDivisor(i) # then find the sum of its divisors > > oops redefine what sum is. > > > > >>> x = [1,2] > >>> sum(x) > 3 > >>> sum = 4 > >>> sum(x) > > Traceback (most recent call last): > File "", line 1, in > sum(x) > TypeError: 'int' object is not callable > > > > - Hide quoted text - > > - Show quoted text - I am an IDIOT! Thanks, mzdude! That did the trick. Sorry for posting something this stupid. -- http://mail.python.org/mailman/listinfo/python-list
Re: Books to begin learning Python
> > There's lots of good books to read, including a few online ones. A lot > > of people like "Dive Into Python" (http://diveintopython.org/). If you > > want LOTS of information and some good code examples, Lutz's > > "Programming Python 3rd Ed" is great. > > I have the 2nd edition. Has the 3rd edition been rewritten so that all > of its code will be valid in Python 3? I'd prefer not to buy Python > books that will become obsolete. As a relative newcomer to Python, I found that "Dive Into Python" was initially out of my league. It's written assuming that you have a good understanding of basic Python concepts. Since I didn't have this initial mastery of the language, I didn't find it useful. Now that I've been working with the language for awhile, however, I do come back and refer to it from time to time. Some good online tutorials that I found really helpful include: (1) Python Tutorial http://docs.python.org/tut/tut.html (2) A Byte of Python http://www.ibiblio.org/swaroopch/byteofpython/read/ (3) How to Think Like a Computer Scientist http://www.greenteapress.com/thinkpython/thinkCSpy/html/index.html Incidentally, you can find documentatio for Python v3.0 at the official Python site here: http://docs.python.org/dev/3.0/ I hope that helps. Good luck! Samir -- http://mail.python.org/mailman/listinfo/python-list
Re: The Python Papers, Volume 3 Issue 2
On Sep 4, 8:58 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi everyone > > After a long wait of nearly 5 month, we are back in business to bring > the latest edition of The Python Papers - Volume 3 Issue 2 (http:// > ojs.pythonpapers.org/index.php/tpp/issue/current). > > From this issue onwards, we will be having only 3 issues per year > instead of 4. This is in compliance with our ISSN registration. > > What's new > = > 1. We have expanded our editorial team with 2 new Associate Editors, > Sarah Mount (from UK) and Guy Kloss from (New Zealand). > > 2. TPP is now managed using Open Journal System and it can be assessed > athttp://ojs.pythonpapers.org/tpp > > 3. Backporting of previous issues of TPP from Volume 1 Issue 1 is > complete > > 4. We had "soft-launched" TWO new periodicals - The Python Papers > Monographs (for monograph-length submissions which may include > dissertations, conference proceedings, case studies and advanced-level > lectures) and The Python Papers Source Codes (modeled after ACM > Collected Algorithms and provides a collection of software and source > codes, usually associated with papers published in The Python Papers > and The Python Papers Monograph). They shall be TPPM and TPPSC > respectively. > > 5. Collectively, TPP, TPPM and TPPSC will be umbrella-ed as The Python > Papers Anthology (TPPA) and managed under the same editorial > committee. > > 6. Probably the most important development to TPP is that TPP is > currently indexed by a number of services, including Google Scholar > and OAIster, as a result of using Open Journal System. > > So, please enjoy our latest edition and we look towards all of your > continued support and contributions. > > Thank you. > > Cheers > Maurice Ling > Co-Editor-in-Chief, The Python Papers Anthology Good to see that the newest edition of the journal is out. Also, I believe the correct URL should either be: http://ojs.pythonpapers.org/ or http://ojs.pythonpapers.org/index.php/tpp Thanks for providing this great resource. Samir -- http://mail.python.org/mailman/listinfo/python-list
PyQt QScrollView/QGridLayout question
folks, I am trying put some user input fields into a scrollable (QScrollView) window. So, I placed a QLabel at 0,0 and QLineEdit at 0,1, next to QLabel. Somehow, results are not what I am expecting.It is placing QLineEdit below QLabel. I am not using designer for this. Please, notice that I convert vbox's box layout into grid layout, so that, I can place QLabel at 0,0 and QLineEdit at 0,1. But it does not do that. any advice on correcting this piece of code will be helpfull. regards, here is how this code looks like: - import sys, qt from qt import * class MyDialog(QDialog): def __init__(self,parent = None,name = None,modal = 0,fl = 0): QDialog.__init__(self,parent,name,modal,fl) if not name: self.setName("MyDialog") self.setSizeGripEnabled(1) self.build_window() def build_window(self): toplayout = QGridLayout(self,1,1,11,6,"toplayout") vbMain = qt.QVBox(self) toplayout.addWidget(vbMain, 0, 0) sview = qt.QScrollView(vbMain) vp = sview.viewport() vbox = qt.QVBox(vp) sview.addChild(vbox) vplayout = qt.QGridLayout(vp, 0, 0, 1,-1, 'vpl') vplayout.addWidget(vbox, 0, 0) grid = qt.QGridLayout(vbox.layout(), 2, 2) ll = qt.QLabel('circuit name', vbox) grid.addWidget(ll, 0,0, qt.Qt.AlignLeft) nameinput = qt.QLineEdit(vbox) grid.addWidget(nameinput, 0,1, qt.Qt.AlignLeft) if __name__ == "__main__": app = QApplication(sys.argv) f = MyDialog() f.show() app.setMainWidget(f) app.exec_loop() -- http://mail.python.org/mailman/listinfo/python-list
Re: py2exe and croatian letters
Mark Tolonen wrote: "Samir aluko...@work" wrote in message news:ab6475d0-133c-478d-8f08-eafea0733...@j39g2000yqh.googlegroups.com... I am making a simple program in Croatian. In the beginning I set "# - *- coding: cp1250 -*-" code and when i run it in Python shell it comes out fine, but when i compile it with py2exe he doesn't print out croatian letters but he prints out tottaly other letters. I checked the CMD and it supports croatian letters. If you want an source code and setup file send me an e-mail at a.dexter...@gmail.com Not knowing what were considered Croatian characters, I found http://www.geocities.com/click2speak/unicode/chars_hr.html for my testing. Run 'chcp' from CMD and see what code page you are in. I was able to output correctly by changing the codepage from 437 (my U.S. default), to 1250. I also had to change my console window font from 'Raster Fonts' to 'Lucida Console', since the former supported the cp437 character set only. -Mark @mark i checked and he is showing cp852. i'll try to change the cp and then i'll inform you. -- http://mail.python.org/mailman/listinfo/python-list
Re: py2exe and croatian letters
Mark Tolonen wrote: "Samir aluko...@work" wrote in message news:ab6475d0-133c-478d-8f08-eafea0733...@j39g2000yqh.googlegroups.com... I am making a simple program in Croatian. In the beginning I set "# - *- coding: cp1250 -*-" code and when i run it in Python shell it comes out fine, but when i compile it with py2exe he doesn't print out croatian letters but he prints out tottaly other letters. I checked the CMD and it supports croatian letters. If you want an source code and setup file send me an e-mail at a.dexter...@gmail.com Not knowing what were considered Croatian characters, I found http://www.geocities.com/click2speak/unicode/chars_hr.html for my testing. Run 'chcp' from CMD and see what code page you are in. I was able to output correctly by changing the codepage from 437 (my U.S. default), to 1250. I also had to change my console window font from 'Raster Fonts' to 'Lucida Console', since the former supported the cp437 character set only. -Mark it is working thank you guys -- http://mail.python.org/mailman/listinfo/python-list
py2exe and croatian letters
I am making a simple program in Croatian. In the beginning I set "# - *- coding: cp1250 -*-" code and when i run it in Python shell it comes out fine, but when i compile it with py2exe he doesn't print out croatian letters but he prints out tottaly other letters. I checked the CMD and it supports croatian letters. If you want an source code and setup file send me an e-mail at a.dexter...@gmail.com -- http://mail.python.org/mailman/listinfo/python-list