Re: define variables in the txt file using python

2016-10-07 Thread dieter
Xristos Xristoou writes: > 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% > result = %vresul

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

2016-10-07 Thread Cai Gengyang
Unfortunately, in this case, it is 100% of the information I am giving you. You can try it yourself. The code is in the first section (8.1) of http://programarcadegames.com/index.php?chapter=introduction_to_animation&lang=en#section_8 Just copy and paste it into your Python IDLE and let me know

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

2016-10-07 Thread Steve D'Aprano
On Sat, 8 Oct 2016 05:02 pm, Cai Gengyang wrote: > Any idea how to correct this error ? Looks fine to me As usual, the first and most important rule of debugging is to use ALL the information the compiler gives you. Where is the rest of the traceback? At the very least, even if nothing else,

SyntaxError: multiple statements found while compiling a single statement

2016-10-07 Thread Cai Gengyang
Any idea how to correct this error ? Looks fine to me >>> rect_x = 50 # Main Program Loop --- while not done: for event in pygame.event.get(): # User did something if event.type == pygame.QUIT: # If user clicked close done = True # Flag that we are d

Re: Doubled backslashes in Windows paths [Resolved]

2016-10-07 Thread BartC
On 07/10/2016 18:41, Oz-in-DFW wrote: On 10/7/2016 12:30 AM, Oz-in-DFW wrote: I'm using Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:01:18) [MSC v.1900 32 bit (Intel)] on Windows 7 I'm trying to write some file processing that looks at file size, extensions, and several other things and I

Re: Question on multiple Python users in one application

2016-10-07 Thread Gregory Ewing
Dennis Lee Bieber wrote: normally the main file of a Python program is still the plain text, It doesn't have to be, though -- you can do 'python somefile.pyc' and it will happily run it. and imported modules are retrieved from the file system as (if found) PYC pre-compiled, otherwise the text

Re: Question on multiple Python users in one application

2016-10-07 Thread Gregory Ewing
Dennis Lee Bieber wrote: What is it... A Burroughs mainframe running a version of FORTH? The Burroughs architecture is a stack architecture, so the machine code looks like a version of Forth in some ways. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

define variables in the txt file using python

2016-10-07 Thread 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 like this : input number 1= %var1% input number 2= %var2% result = %vresult(var1-var2)% how can i write a

Re: Doubled backslashes in Windows paths [Resolved]

2016-10-07 Thread Oz-in-DFW
On 10/7/2016 12:30 AM, Oz-in-DFW wrote: > I'm using Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:01:18) [MSC > v.1900 32 bit (Intel)] on Windows 7 > > I'm trying to write some file processing that looks at file size, > extensions, and several other things and I'm having trouble getting a > re

Re: xml parsing with lxml

2016-10-07 Thread Doug OLeary
On Friday, October 7, 2016 at 3:21:43 PM UTC-5, John Gordon wrote: > root = doc.getroot() > for child in root: > print(child.tag) > Excellent! thank, you sir! that'll get me started. Appreciate the reply. Doug O'Leary -- https://mail.python.org/mailman/listinfo/python-list

Re: xml parsing with lxml

2016-10-07 Thread John Gordon
In <622ea3b0-88b4-420b-89e0-9e7c6e866...@googlegroups.com> Doug OLeary writes: > >>> from lxml import etree > >>> doc =3D etree.parse('config.xml') > Now what? For instance, how do I list the top level children of > ? root = doc.getroot() for child in root: print(child.tag) -- John Gord

Re: BeautifulSoup help !!

2016-10-07 Thread Navneet Siddhant
i was able to almost get the results i require but only half of the info is showing up. i.e suppose there are 20 coupons showing on the page but when i print them using the container they are in only 5 are printed on the screen. Also figured out how to write to csv file , but even here only 1 ro

xml parsing with lxml

2016-10-07 Thread Doug OLeary
Hey; I'm trying to gather information from a number of weblogic configuration xml files using lxml. I've found any number of tutorials on the web but they all seem to assume a knowledge that I apparently don't have... that, or I'm just being rock stupid today - that's distinct possibility too.

Re: Passing Variable to Function

2016-10-07 Thread John McKenzie
Brendan and Alister, thank you both for responding. I am very inexperienced with python, but not new to computers so on my own I realized the strings vs number mistake. (I seem to work with and learn about Python for a few weeks at a time with 6 to 12 months in between. Need to change that a

Re: default argument value is mutable

2016-10-07 Thread Marko Rauhamaa
"D'Arcy J.M. Cain" : > On Fri, 07 Oct 2016 16:09:19 +0200 > jmp wrote: >> What about >> >> def test(): >>if not hasattr(test, '_store'): test._store={'x':0} >>test._store['x'] += 1 > > Why is everyone working so hard to avoid creating a class? Hear, hear! Marko -- https://mail.python

Re: bugreport os.path.dirname and os.path.basename

2016-10-07 Thread Chris Angelico
On Sat, Oct 8, 2016 at 4:34 AM, h2m2 wrote: > os.path.dirname('G:\Programmierung\Python\Portugal > Training\Python-for-Algorithms--Data-Structures--and--Life\Algorithm > Analysis and Big O\testFile.ipynb') > > result and bug is: > 'G:\\Programmierung\\Python\\Portugal > Training\\Python-for-Algori

bugreport os.path.dirname and os.path.basename

2016-10-07 Thread h2m2
in the meantime, I am subscribed and confirmed - the bug below as requested - Original message - From: h2m2 To: python-list@python.org Subject: bugreport os.path.dirname and os.path.basename Date: Wed, 05 Oct 2016 16:49:17 +0200 bug: os.path.dirname('G:\Programmierung\Python\Portugal

Re: segfault using shutil.make_archive

2016-10-07 Thread Michael Torrie
On 10/06/2016 10:46 AM, Tim wrote: > I need to zip up a directory that's about 400mb. > I'm using shutil.make_archive and I'm getting this response: > > Segmentation fault: 11 (core dumped) > > The code is straightforward (and works on other, smaller dirs): > > shutil.make_archive(os.pat

Re: BeautifulSoup help !!

2016-10-07 Thread Pierre-Alain Dorange
Navneet Siddhant wrote: > I guess I will have to extract data from multiple divs as only extracting > data from the parent div which has other divs in it with the different > data is coming up all messed up. Will play around and see if I could get > through it. Let me clarify once again I dont ne

Re: Doubled backslashes in Windows paths

2016-10-07 Thread BartC
On 07/10/2016 13:39, BartC wrote: On 07/10/2016 06:30, Oz-in-DFW wrote: I'm getting an error message on an os.path.getsize call; But the main error appears to be due to the presence of quotes, whether at each end, or inside the path, enclosing an element with spaces for example. Try using l

Re: segfault using shutil.make_archive

2016-10-07 Thread Tim
On Friday, October 7, 2016 at 5:18:11 AM UTC-4, Chris Angelico wrote: > On Fri, Oct 7, 2016 at 5:24 PM, dieter wrote: > > Memory allocations are frequent (in many places) and they fail rarely. > > Therefore, there is quite a high probability that some of those > > allocations fail to check that the

Re: default argument value is mutable

2016-10-07 Thread ast
"jmp" a écrit dans le message de news:mailman.213.1475849391.30834.python-l...@python.org... On 10/07/2016 03:45 PM, ast wrote: "jmp" a écrit dans le message de news:mailman.210.1475844513.30834.python-l...@python.org... On 10/07/2016 02:07 PM, ast wrote: "jmp" a écrit dans le message d

Re: default argument value is mutable

2016-10-07 Thread D'Arcy J.M. Cain
On Fri, 07 Oct 2016 16:09:19 +0200 jmp wrote: > What about > > def test(): >if not hasattr(test, '_store'): test._store={'x':0} >test._store['x'] += 1 Why is everyone working so hard to avoid creating a class? -- D'Arcy J.M. Cain System Administrator, Vex.Net http://www.Vex.Net/ IM:da.

Re: default argument value is mutable

2016-10-07 Thread jmp
On 10/07/2016 03:45 PM, ast wrote: "jmp" a écrit dans le message de news:mailman.210.1475844513.30834.python-l...@python.org... On 10/07/2016 02:07 PM, ast wrote: "jmp" a écrit dans le message de news:mailman.209.1475841371.30834.python-l...@python.org... On 10/07/2016 01:38 PM, Daiyue Wen

Re: Doubled backslashes in Windows paths

2016-10-07 Thread eryk sun
On Fri, Oct 7, 2016 at 10:46 AM, Steve D'Aprano wrote: > That's because > > "C: > > is an illegal volume label (disk name? I'm not really a Windows user, and > I'm not quite sure what the correct terminology here would be). It's not an illegal device name, per se. A DOS device can be defined

Re: Doubled backslashes in Windows paths

2016-10-07 Thread Ned Batchelder
On Friday, October 7, 2016 at 8:39:55 AM UTC-4, BartC wrote: > On 07/10/2016 06:30, Oz-in-DFW wrote: > > I'm using Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:01:18) [MSC > > v.1900 32 bit (Intel)] on Windows 7 > > > > I'm trying to write some file processing that looks at file size, > > ext

Re: default argument value is mutable

2016-10-07 Thread ast
"jmp" a écrit dans le message de news:mailman.210.1475844513.30834.python-l...@python.org... On 10/07/2016 02:07 PM, ast wrote: "jmp" a écrit dans le message de news:mailman.209.1475841371.30834.python-l...@python.org... On 10/07/2016 01:38 PM, Daiyue Weng wrote: So the rule of thumb f

Re: default argument value is mutable

2016-10-07 Thread Steve D'Aprano
On Fri, 7 Oct 2016 11:48 pm, jmp wrote: > On 10/07/2016 02:07 PM, ast wrote: >> It can be used to store some variables from one call of >> a function to an other one. >> >> def test( _store={'x':0}): >> >> x = _store['x'] >> . do some stuff >>_store['x'] = x > > For personal dirt

Re: default argument value is mutable

2016-10-07 Thread Steve D'Aprano
On Fri, 7 Oct 2016 10:38 pm, Daiyue Weng wrote: > Hi, I declare two parameters for a function with default values [], > > def one_function(arg, arg1=[], arg2=[]): > > PyCharm warns me: > > Default argument value is mutable, > > what does it mean? and how to fix it? The usual way to avoid tha

Re: Doubled backslashes in Windows paths

2016-10-07 Thread eryk sun
On Fri, Oct 7, 2016 at 9:27 AM, Peter Otten <__pete...@web.de> wrote: > To fix the problem either use forward slashes (which are understood by > Windows, too) Using forward slash in place of backslash is generally fine, but you need to be aware of common exceptions, such as the following: (1) Pat

Re: default argument value is mutable

2016-10-07 Thread jmp
On 10/07/2016 02:07 PM, ast wrote: "jmp" a écrit dans le message de news:mailman.209.1475841371.30834.python-l...@python.org... On 10/07/2016 01:38 PM, Daiyue Weng wrote: So the rule of thumb for default argument value is "No mutable" Cheers, It can be used to store some variables from

Re: Doubled backslashes in Windows paths

2016-10-07 Thread BartC
On 07/10/2016 06:30, Oz-in-DFW wrote: I'm using Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:01:18) [MSC v.1900 32 bit (Intel)] on Windows 7 I'm trying to write some file processing that looks at file size, extensions, and several other things and I'm having trouble getting a reliably usab

Re: default argument value is mutable

2016-10-07 Thread ast
"jmp" a écrit dans le message de news:mailman.209.1475841371.30834.python-l...@python.org... On 10/07/2016 01:38 PM, Daiyue Weng wrote: So the rule of thumb for default argument value is "No mutable" Cheers, It can be used to store some variables from one call of a function to an other

Re: default argument value is mutable

2016-10-07 Thread ast
"Daiyue Weng" a écrit dans le message de news:mailman.208.1475840291.30834.python-l...@python.org... Hi, I declare two parameters for a function with default values [], def one_function(arg, arg1=[], arg2=[]): PyCharm warns me: Default argument value is mutable, what does it mean? and how

Re: default argument value is mutable

2016-10-07 Thread jmp
On 10/07/2016 01:38 PM, Daiyue Weng wrote: Hi, I declare two parameters for a function with default values [], def one_function(arg, arg1=[], arg2=[]): PyCharm warns me: Default argument value is mutable, what does it mean? and how to fix it? cheers You'll run into this bug def foo(a=[])

default argument value is mutable

2016-10-07 Thread Daiyue Weng
Hi, I declare two parameters for a function with default values [], def one_function(arg, arg1=[], arg2=[]): PyCharm warns me: Default argument value is mutable, what does it mean? and how to fix it? cheers -- https://mail.python.org/mailman/listinfo/python-list

Re: Doubled backslashes in Windows paths

2016-10-07 Thread Steve D'Aprano
On Fri, 7 Oct 2016 04:30 pm, Oz-in-DFW wrote: > I'm using Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:01:18) [MSC > v.1900 32 bit (Intel)] on Windows 7 > > I'm trying to write some file processing that looks at file size, > extensions, and several other things and I'm having trouble gettin

Re: Doubled backslashes in Windows paths

2016-10-07 Thread Peter Otten
Oz-in-DFW wrote: > I'm using Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:01:18) [MSC > v.1900 32 bit (Intel)] on Windows 7 > > I'm trying to write some file processing that looks at file size, > extensions, and several other things and I'm having trouble getting a > reliably usable path to

Re: Doubled backslashes in Windows paths

2016-10-07 Thread Stephen Tucker
Hi Oz, This might only be tangential to your actual issue, but, there again, it might be the tiny clue that you actually need. In Python, I use raw strings and single backslashes in folder hierarchy strings to save the problem of the backslash in ordinary strings. Even with this policy, however,

Re: segfault using shutil.make_archive

2016-10-07 Thread Chris Angelico
On Fri, Oct 7, 2016 at 5:24 PM, dieter wrote: > Memory allocations are frequent (in many places) and they fail rarely. > Therefore, there is quite a high probability that some of those > allocations fail to check that the allocation has been successful. > If this happens (and the allocation fails)

Re: static, class and instance methods

2016-10-07 Thread Steve D'Aprano
On Fri, 7 Oct 2016 04:01 pm, ast wrote: > > "Gregory Ewing" a écrit dans le message de > news:e5mgi9fp1b...@mid.individual.net... >> Lawrence D’Oliveiro wrote: >>> >>> Every function is already a descriptor. >> >> Which you can see with a simple experiment: >> >> >>> def f(self): >> ... print("

Re: Question on multiple Python users in one application

2016-10-07 Thread Gregory Ewing
Loren Wilton wrote: One concern I have is if two users both "import widget". Are they now sharing the widget namespace? I suspect they are, and that is probably undesirable. Yes, they will be, unless you use sub-interpreters. I've just been looking at the current docs for sub-interpreters, and

Doubled backslashes in Windows paths

2016-10-07 Thread Oz-in-DFW
I'm using Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:01:18) [MSC v.1900 32 bit (Intel)] on Windows 7 I'm trying to write some file processing that looks at file size, extensions, and several other things and I'm having trouble getting a reliably usable path to files. The problem *seems* t

Re: Question on multiple Python users in one application

2016-10-07 Thread Gregory Ewing
Loren Wilton wrote: I've read that Python supports 'threads', and I'd assumed (maybe incorrectly) that these were somewhat separate environments that could be operating concurrently (modulo the GC lock). Not really. Python threads are just a thin wrapper around OS threads, and don't provide an