Re: SyntaxError: multiple statements found while compiling a single statement

2016-10-08 Thread Steve D'Aprano
On Sat, 8 Oct 2016 05:29 pm, Cai Gengyang wrote: > Unfortunately, in this case, it is 100% of the information I am giving > you. Exactly. That's the problem. You need to give us more information, like how you are trying to run this code. Are you using an IDE? Which IDE? > You can try it yourse

Re: SyntaxError: multiple statements found while compiling a single statement

2016-10-08 Thread Cai Gengyang
This is the result when I copy and paste it one line at a time : >>> rect_x = 50 >>> rect_y = 50 >>> while not done: >>> for event in pygame.event.get():

Re: define variables in the txt file using python

2016-10-08 Thread Peter Otten
Xristos Xristoou wrote: > hello > > > i have one .txt file and i want to create python script with sys.argv or > argparse or other package to define some variables in the txt file and i > take some result. > > > > txt file maybe like this : > > input number 1= %var1% > input number 2= %var2%

how to refactor nested for loop into smaller for loop assume each of them independent?

2016-10-08 Thread meInvent bbird
how to refactor nested for loop into smaller for loop assume each of them independent? because memory is not enough for ii in range(1,2000): for jj in range(1,2000): for kk in range(1,2000): print run(ii,jj,kk) -- https://mail.python.org/mailman/listinfo/python-list

Re: how to refactor nested for loop into smaller for loop assume each of them independent?

2016-10-08 Thread Chris Angelico
On Sat, Oct 8, 2016 at 8:58 PM, meInvent bbird wrote: > how to refactor nested for loop into smaller for loop assume each of them > independent? > > because memory is not enough > > for ii in range(1,2000): > for jj in range(1,2000): > for kk in range(1,2000): > print run(ii,jj,kk) Since

Re: how to refactor nested for loop into smaller for loop assume each of them independent?

2016-10-08 Thread BartC
On 08/10/2016 11:03, Chris Angelico wrote: On Sat, Oct 8, 2016 at 8:58 PM, meInvent bbird wrote: how to refactor nested for loop into smaller for loop assume each of them independent? because memory is not enough for ii in range(1,2000): for jj in range(1,2000): for kk in range(1,2000):

Re: how to refactor nested for loop into smaller for loop assume each of them independent?

2016-10-08 Thread Chris Angelico
On Sat, Oct 8, 2016 at 9:12 PM, BartC wrote: > On 08/10/2016 11:03, Chris Angelico wrote: >> >> On Sat, Oct 8, 2016 at 8:58 PM, meInvent bbird >> wrote: >>> >>> how to refactor nested for loop into smaller for loop assume each of them >>> independent? >>> >>> because memory is not enough >>> >>>

Re: SyntaxError: multiple statements found while compiling a single statement

2016-10-08 Thread Rustom Mody
On Saturday, October 8, 2016 at 1:21:50 PM UTC+5:30, Cai Gengyang wrote: > This is the result when I copy and paste it one line at a time : > > >>> rect_x = 50 > >>> rect_y = 50 > >>> while not done: > >>> > for event in ... Th

Re: how to refactor nested for loop into smaller for loop assume each of them independent?

2016-10-08 Thread BartC
On 08/10/2016 11:54, Chris Angelico wrote: On Sat, Oct 8, 2016 at 9:12 PM, BartC wrote: On 08/10/2016 11:03, Chris Angelico wrote: On Sat, Oct 8, 2016 at 8:58 PM, meInvent bbird wrote: how to refactor nested for loop into smaller for loop assume each of them independent? because memory is

Re: how to refactor nested for loop into smaller for loop assume each of them independent?

2016-10-08 Thread Steve D'Aprano
On Sat, 8 Oct 2016 09:12 pm, BartC wrote: > The OP's code however is a good demonstration of how crazy Python's > original for-range loop was: you need to construct a list of N elements > just to be able to count to N. How many years was it until xrange was > introduced? Python 1.4 (that's 1996)

Re: how to refactor nested for loop into smaller for loop assume each of them independent?

2016-10-08 Thread Alain Ketterlin
meInvent bbird writes: > how to refactor nested for loop into smaller for loop assume each of them > independent? > > because memory is not enough > > for ii in range(1,2000): > for jj in range(1,2000): > for kk in range(1,2000): > print run(ii,jj,kk) n = 0 while n < 2000*2000*2000:

Re: define variables in the txt file using python

2016-10-08 Thread Xristos Xristoou
Τη Σάββατο, 8 Οκτωβρίου 2016 - 12:25:28 π.μ. UTC+3, ο χρήστης Xristos Xristoou έγραψε: > hello > > > i have one .txt file and i want to create python script with sys.argv or > argparse or other package to define some variables in the txt file and i take > some result. > > > > txt file maybe

Re: SyntaxError: multiple statements found while compiling a single statement

2016-10-08 Thread Cai Gengyang
Somehow it still doesnt work --- it keeps giving the syntaxerror, inconsistent use of tabs and indentation message EVEN though i use only the enter and space buttons and never touched the tab button a single time. Im pretty sure there is something wrong with the program itself. Gonna download py

[ANN] aioxmpp 0.7.1 (sic!) released

2016-10-08 Thread Jonas Wielicki
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 Dear subscribers, I am pleased to announce the release of aioxmpp 0.7.1 (footnote 1). The current release can be obtained from GitHub [1] (check out the v0.6.0 tag or the master branch) or PyPI [2]. The HTML documentation can be found at [3]. Exa

Re: define variables in the txt file using python

2016-10-08 Thread Peter Otten
Xristos Xristoou wrote: > Τη Σάββατο, 8 Οκτωβρίου 2016 - 12:25:28 π.μ. UTC+3, ο χρήστης Xristos > Xristoou έγραψε: >> hello >> >> >> i have one .txt file and i want to create python script with sys.argv or >> argparse or other package to define some variables in the txt file and i >> take some r

Re: SyntaxError: multiple statements found while compiling a single statement

2016-10-08 Thread breamoreboy
On Saturday, October 8, 2016 at 12:07:47 PM UTC+1, Rustom Mody wrote: > On Saturday, October 8, 2016 at 1:21:50 PM UTC+5:30, Cai Gengyang wrote: > > This is the result when I copy and paste it one line at a time : > > > > >>> rect_x = 50 > > >>> rect_y = 50 > > >>> while not done:

Re: how to refactor nested for loop into smaller for loop assume each of them independent?

2016-10-08 Thread Random832
On Sat, Oct 8, 2016, at 06:12, BartC wrote: > The OP's code however is a good demonstration of how crazy Python's > original for-range loop was: you need to construct a list of N elements > just to be able to count to N. How many years was it until xrange was > introduced? Python 1.4 had it, an

Re: how to refactor nested for loop into smaller for loop assume each of them independent?

2016-10-08 Thread Random832
On Sat, Oct 8, 2016, at 07:29, Steve D'Aprano wrote: > The oldest version I have access to is the *extremely* primitive 0.9. Not > surprisingly, it doesn't have xrange -- but it lacks a lot of things, > including globals(), map(), named exceptions, "" strings ('' is okay), > exponentiation, and mor

Re: SyntaxError: multiple statements found while compiling a single statement

2016-10-08 Thread Terry Reedy
On 10/8/2016 2:56 AM, Steve D'Aprano wrote: Just copy and paste it into your Python IDLE and let me know what you get I don't normally use IDLE, and you shouldn't assume that everyone does. *That* is the extra information we need to solve the problem: The IDLE interactive interpreter in Pyth

delete pixel from the raster image with specific range value

2016-10-08 Thread chrischris201444
any idea how to delete pixel from the raster image with specific range value using numpy/scipy or gdal? for example i have a raster image with the 5 class : 1. 0-100 2. 100-200 3. 200-300 4. 300-500 5. 500-1000 and i want to delete class 1 range value or maybe class 1,2,4,5 -- https://mail.pyt

Re: SyntaxError: multiple statements found while compiling a single statement

2016-10-08 Thread Gregory Ewing
Cai Gengyang wrote: Somehow it still doesnt work --- it keeps giving the syntaxerror, inconsistent use of tabs and indentation message EVEN though i use only the enter and space buttons and never touched the tab button a single time. There was another thread about this a short time ago. It turn

Re: how to refactor nested for loop into smaller for loop assume each of them independent?

2016-10-08 Thread Chris Angelico
On Sun, Oct 9, 2016 at 5:45 AM, Random832 wrote: > On Sat, Oct 8, 2016, at 07:29, Steve D'Aprano wrote: >> The oldest version I have access to is the *extremely* primitive 0.9. Not >> surprisingly, it doesn't have xrange -- but it lacks a lot of things, >> including globals(), map(), named excepti

Re: how to refactor nested for loop into smaller for loop assume each of them independent?

2016-10-08 Thread Steve D'Aprano
On Sun, 9 Oct 2016 05:45 am, Random832 wrote: > On Sat, Oct 8, 2016, at 07:29, Steve D'Aprano wrote: >> The oldest version I have access to is the *extremely* primitive 0.9. Not >> surprisingly, it doesn't have xrange -- but it lacks a lot of things, >> including globals(), map(), named exceptions

Re: how to refactor nested for loop into smaller for loop assume each of them independent?

2016-10-08 Thread Steve D'Aprano
On Sun, 9 Oct 2016 12:53 pm, Chris Angelico wrote: >> They're caught by identity, though - "except 'type error'" fails to >> catch TypeError, and vice versa. > > Fascinating! What about: except sys.intern('type error') ? Or does > interning of strings not exist yet :) >>> intern Unhandled except

Re: SyntaxError: multiple statements found while compiling a single statement

2016-10-08 Thread Cai Gengyang
This is my latest result : I copy and pasted one line at a time into the IDLE and used ONLY the "enter-return" button to move on to the next line and this time I didnt get an indentation error but instead a traceback error >>> rect_x = 50 >>> rect_y = 50 >>> while not done: for event in

Re: SyntaxError: multiple statements found while compiling a single statement

2016-10-08 Thread Steve D'Aprano
On Sun, 9 Oct 2016 01:51 pm, Cai Gengyang wrote: > This is my latest result : I copy and pasted one line at a time into the > IDLE and used ONLY the "enter-return" button to move on to the next line > and this time I didnt get an indentation error but instead a traceback > error: > Traceback (mos

Re: SyntaxError: multiple statements found while compiling a single statement

2016-10-08 Thread Cai Gengyang
I defined both done and pygame in this piece of code, but now i get a new error that i have never seen before, an AttributeError >>> rect_x = 50 >>> rect_y = 50 >>> done = False >>> pygame = True >>> while not done: for event in pygame.event.get(): if event.type == pygame.QUI

Re: PyQt5, OpenGL, where to start, minimal example code?

2016-10-08 Thread John Ladasky
Well, I've made some progress. My program doesn't draw any 3D objects yet, but it creates an OpenGL rendering window, binds the OpenGL functions, and generates no errors. Here's the corrected initializeGL method: def initializeGL(self): c = self.context() f = QSurfaceForma

Re: SyntaxError: multiple statements found while compiling a single statement

2016-10-08 Thread Terry Reedy
On 10/8/2016 11:51 PM, Cai Gengyang wrote: pygame = True while not done: for event in pygame.event.get(): Traceback (most recent call last): File "", line 2, in for event in pygame.event.get(): AttributeError: 'bool' object has no attribute 'event' pygame == True and True ha

Re: SyntaxError: multiple statements found while compiling a single statement

2016-10-08 Thread Steve D'Aprano
On Sun, 9 Oct 2016 02:51 pm, Cai Gengyang wrote: > I defined both done and pygame in this piece of code, but now i get a new > error that i have never seen before, an AttributeError AttributeError usually means you have the wrong kind of object: py> mylist = {} # oops, a dict not a list py> myl

Re: SyntaxError: multiple statements found while compiling a single statement

2016-10-08 Thread Rustom Mody
On Sunday, October 9, 2016 at 12:12:06 PM UTC+5:30, Steve D'Aprano wrote: > On Sun, 9 Oct 2016 02:51 pm, Cai Gengyang wrote: > > > I defined both done and pygame in this piece of code, but now i get a new > > error that i have never seen before, an AttributeError > > AttributeError usually means