Re:Command prompt not shown when running Python script with subprocess on Windows
ps16thypresenceisfullnessof...@gmail.com Wrote in message: > I have written a Python script with a wxPython GUI that uses subprocess.Popen > to open a list of files that the user provides. One of my users would like to > be able to run a Python script with my application. The Python script he is > trying to run uses the command line and gets keyboard input from the user > several times. > > The problem is that if the Python script is run on Windows with > subprocess.Popen, no command prompt is shown (my GUI application is a .pyw > file). The user's script runs silently but then does not quit because it is > waiting for input, but there is no way for the input to be given, since there > is no command prompt visible. > > I think this may be related to the fact that I am calling subprocess.Popen > with shell=True. I tried calling it with shell=False (the default), but then > I got an error that the file is not a valid Win32 application. > > I would appreciate any help with this problem. > > -- Timothy > If you want to use shell=False, you need to specify the executable correctly. Since you're on Windows, the executable is named python.exe, not myscript. py If you still get errors, you need to get a lot more explicit. Copy/paste, not paraphrase. -- DaveA -- https://mail.python.org/mailman/listinfo/python-list
Re: Command prompt not shown when running Python script with subprocess on Windows
You need to call python.exe path-to-script.py, I think, not just path-to-script.py. See sys.executable (though that depends on if you're a frozen app or not). I can't be sure though because there's no code. Show code when asking questions, it helps frame the discussion and get a better answer ;) On Mon, May 26, 2014 at 5:03 PM, wrote: > I have written a Python script with a wxPython GUI that uses > subprocess.Popen to open a list of files that the user provides. One of my > users would like to be able to run a Python script with my application. The > Python script he is trying to run uses the command line and gets keyboard > input from the user several times. > > The problem is that if the Python script is run on Windows with > subprocess.Popen, no command prompt is shown (my GUI application is a .pyw > file). The user's script runs silently but then does not quit because it is > waiting for input, but there is no way for the input to be given, since > there is no command prompt visible. > > I think this may be related to the fact that I am calling subprocess.Popen > with shell=True. I tried calling it with shell=False (the default), but > then I got an error that the file is not a valid Win32 application. > > I would appreciate any help with this problem. > > -- Timothy > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list
Python box (home-use smart router)
Home-use smart router is more and more popular. If embeds Python into such router, and develops a framework that has the following features: 1, allow power-down at any time 2, dynamic domain name 3, local storage support (SD cards or Hard Disk) 4, telnet server etc. Then we can create micro private server on it. Still can't see the full prospect, but it may be a great platform for people's imagination. I think Python is very suitable for such role. -- https://mail.python.org/mailman/listinfo/python-list
Check to see if the script has been previously used?
Hi, I was wondering if there was an extension or way that would allow me to print instructions if it is the first the the user has used the script. Thanks, KC -- https://mail.python.org/mailman/listinfo/python-list
Re: Check to see if the script has been previously used?
On Tue, May 27, 2014 at 5:45 PM, KC Sparks wrote: > I was wondering if there was an extension or way that would allow me to > print instructions if it is the first the the user has used the script. The trickiest part is defining the 'user'. Generally, this sort of thing is done by creating a file; if the file's not there, it's the first time. Some versions of sudo will create a file called .sudo_as_admin_successful in the user's home directory; others create /var/lib/sudo/ as a directory, and storing information there. Either technique works well for recognizing a first-time user. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Regular Expression for the special character "|" pipe
I would like to create a regular expression in which i can match the "|" special character too. e.g. start=|ID=ter54rt543d|SID=ter54rt543d|end=| I want to only |ID=ter54rt543d| from the above string but i am unable to write the pattern match containing "|" pipe too. By default python treat "|" as an OR operator. But in my case I want to use to as a part of search string. -- https://mail.python.org/mailman/listinfo/python-list
Re: Check to see if the script has been previously used?
Chris Angelico Wrote in message: > On Tue, May 27, 2014 at 5:45 PM, KC Sparks wrote: >> I was wondering if there was an extension or way that would allow me to >> print instructions if it is the first the the user has used the script. > > The trickiest part is defining the 'user'. Generally, this sort of > thing is done by creating a file; if the file's not there, it's the > first time. Some versions of sudo will create a file called > .sudo_as_admin_successful in the user's home directory; others create > /var/lib/sudo/ as a directory, and storing information > there. Either technique works well for recognizing a first-time user. > > ChrisA > The problem can be simpler if you're assuming a machine with only one user, or more complicated if the obvious disk location is either read-only to the user, or volatile. You also might want to clear all such flags upon an upgrade. If so, it's not just a file needed, but a sortable version string. Preferred approach is usually to respond to one of the conventional argv switches. And let the user decide. -- DaveA -- https://mail.python.org/mailman/listinfo/python-list
Re: Check to see if the script has been previously used?
On Tue, May 27, 2014 at 9:05 PM, Dave Angel wrote: > Preferred approach is usually to respond to one of the > conventional argv switches. And let the user decide. Yes, this is a technique I've used when doing up important (and dangerous) MUD commands. The command will be something like "unload foo" and it gives its first-time spam, or "unload confirm foo" to suppress it and go straight to the potentially-dangerous action. With shell commands, a -f or --force parameter would be common for that. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Regular Expression for the special character "|" pipe
2014-05-27 12:59 GMT+02:00 Aman Kashyap : > I would like to create a regular expression in which i can match the "|" > special character too. > > e.g. > > start=|ID=ter54rt543d|SID=ter54rt543d|end=| > > I want to only |ID=ter54rt543d| from the above string but i am unable to > write the pattern match containing "|" pipe too. > > By default python treat "|" as an OR operator. > > But in my case I want to use to as a part of search string. > -- Hi, you can just escpape the pipe with backlash like any other metacharacter: r"start=\|ID=ter54rt543d" be sure to use the raw string notation r"...", or you can double all backslashes in the string. hth, vbr -- https://mail.python.org/mailman/listinfo/python-list
Re: Regular Expression for the special character "|" pipe
On Tuesday, 27 May 2014 16:39:19 UTC+5:30, Vlastimil Brom wrote: > 2014-05-27 12:59 GMT+02:00 Aman Kashyap : > > > I would like to create a regular expression in which i can match the "|" > > special character too. > > > > > > e.g. > > > > > > start=|ID=ter54rt543d|SID=ter54rt543d|end=| > > > > > > I want to only |ID=ter54rt543d| from the above string but i am unable to > > write the pattern match containing "|" pipe too. > > > > > > By default python treat "|" as an OR operator. > > > > > > But in my case I want to use to as a part of search string. > > > -- > > > > Hi, > > you can just escpape the pipe with backlash like any other metacharacter: > > > > r"start=\|ID=ter54rt543d" > > > > be sure to use the raw string notation r"...", or you can double all > > backslashes in the string. > > > > hth, > >vbr Thanks vbr for the quick response. I have string = |SOH=|ID=re65dgt5dd|DS=fjkjf|SDID=fhkhkf|ID=fkjfkf|EOM=| and want to replace 2 sub-strings |ID=re65dgt5dd| with |ID=MAN| |ID=fkjfkf| with |MAN| I am using regular expression ID=[a-z]*[0-9]*[a-z]*[0-9]*[a-z]*|$ the output is |SOH=|ID=MAN|DS=fjkjf|SDID=MAN|ID=MAN|EOM=|ID=MAN expected value is = |SOH=|ID=MAN|DS=fjkjf|SDID=fhkhkf|ID=MAN|EOM=| could you please help me in this regard? -- https://mail.python.org/mailman/listinfo/python-list
Re: Regular Expression for the special character "|" pipe
What about skipping the re and try this: 'start=|ID=ter54rt543d|SID=ter54rt543d|end=|'.split('|')[1][3:] On 27.05.2014 14:09, Vlastimil Brom wrote: 2014-05-27 12:59 GMT+02:00 Aman Kashyap : I would like to create a regular expression in which i can match the "|" special character too. e.g. start=|ID=ter54rt543d|SID=ter54rt543d|end=| I want to only |ID=ter54rt543d| from the above string but i am unable to write the pattern match containing "|" pipe too. By default python treat "|" as an OR operator. But in my case I want to use to as a part of search string. -- Hi, you can just escpape the pipe with backlash like any other metacharacter: r"start=\|ID=ter54rt543d" be sure to use the raw string notation r"...", or you can double all backslashes in the string. hth, vbr -- https://mail.python.org/mailman/listinfo/python-list
Re: Regular Expression for the special character "|" pipe
On Tuesday, 27 May 2014 16:59:38 UTC+5:30, Daniel wrote: > What about skipping the re and try this: > > > > 'start=|ID=ter54rt543d|SID=ter54rt543d|end=|'.split('|')[1][3:] > > > > On 27.05.2014 14:09, Vlastimil Brom wrote: > > > 2014-05-27 12:59 GMT+02:00 Aman Kashyap : > > >> I would like to create a regular expression in which i can match the "|" > >> special character too. > > >> > > >> e.g. > > >> > > >> start=|ID=ter54rt543d|SID=ter54rt543d|end=| > > >> > > >> I want to only |ID=ter54rt543d| from the above string but i am unable to > >> write the pattern match containing "|" pipe too. > > >> > > >> By default python treat "|" as an OR operator. > > >> > > >> But in my case I want to use to as a part of search string. > > >> -- > > > Hi, > > > you can just escpape the pipe with backlash like any other metacharacter: > > > > > > r"start=\|ID=ter54rt543d" > > > > > > be sure to use the raw string notation r"...", or you can double all > > > backslashes in the string. > > > > > > hth, > > > vbr Thanks for the response. I got the answer finally. This is the regular expression to be used:\\|ID=[a-z]*[0-9]*[a-z]*[0-9]*[a-z]*\\| -- https://mail.python.org/mailman/listinfo/python-list
Re: Regular Expression for the special character "|" pipe
On 27.05.2014 13:39, Aman Kashyap wrote: On 27.05.2014 14:09, Vlastimil Brom wrote: you can just escpape the pipe with backlash like any other metacharacter: r"start=\|ID=ter54rt543d" be sure to use the raw string notation r"...", or you can double all backslashes in the string. Thanks for the response. I got the answer finally. This is the regular expression to be used:\\|ID=[a-z]*[0-9]*[a-z]*[0-9]*[a-z]*\\| or, and more readable: r'\|ID=[a-z]*[0-9]*[a-z]*[0-9]*[a-z]*\|' This is what Vlastimil was talking about. It saves you from having to escape the backslashes. -- https://mail.python.org/mailman/listinfo/python-list
Re: How keep Python 3 moving forward
Le lundi 26 mai 2014 01:09:31 UTC+2, Mark Lawrence a écrit : > On 25/05/2014 23:22, Dennis Lee Bieber wrote: > > > On Sun, 25 May 2014 11:34:59 -0700, Ethan Furman > > > declaimed the following: > > > > > >> On 05/25/2014 10:38 AM, Rustom Mody wrote: > > >>> > > >>> Your unicode is mojibaked Ethan! Voil�. > > >>> You are hereby banished to a lonely island with python 1.5 and jmf for > >>> company :D > > >> > > >> 1.5 I could live with. :( Surely the company would count as cruel and > > >> unusual punishment? > > >> > > > "company"... Or emergency rations? > > > > > > > I suspect that chewing razor blades would be preferable to listening to > > the permanent rant about what's wrong with the FSR. > > > > -- > > My fellow Pythonistas, ask not what our language can do for you, ask > > what you can do for our language. > > > === === It's just a mathematical absurdity. (No problems, to explain this to some other people, who are agreeing). jmf -- https://mail.python.org/mailman/listinfo/python-list
Re: Regular Expression for the special character "|" pipe
In article , Wolfgang Maier wrote: > On 27.05.2014 13:39, Aman Kashyap wrote: > >> On 27.05.2014 14:09, Vlastimil Brom wrote: > >> > >>> you can just escpape the pipe with backlash like any other metacharacter: > >>> > >>> r"start=\|ID=ter54rt543d" > >>> > >>> be sure to use the raw string notation r"...", or you can double all > >> > >>> backslashes in the string. > >> > > Thanks for the response. > > > > I got the answer finally. > > > > This is the regular expression to be > > used:\\|ID=[a-z]*[0-9]*[a-z]*[0-9]*[a-z]*\\| > > > > or, and more readable: > > r'\|ID=[a-z]*[0-9]*[a-z]*[0-9]*[a-z]*\|' > > This is what Vlastimil was talking about. It saves you from having to > escape the backslashes. Sometimes what I do, instead of using backslashes, I put the problem character into a character class by itself. It's a matter of personal opinion which way is easier to read, but it certainly eliminates all the questions about "how many backslashes do I need?" > r'[|]ID=[a-z]*[0-9]*[a-z]*[0-9]*[a-z]*[|]' Another thing that can help make regexes easier to read is the VERBOSE flag. Basically, it ignores whitespace inside the regex (see https://docs.python.org/2/library/re.html#module-contents for details). So, you can write something like: pattern = re.compile(r'''[|] ID= [a-z]* [0-9]* [a-z]* [0-9]* [a-z]* [|]''', re.VERBOSE) Or, alternatively, take advantage of the fact that Python concatenates adjacent string literals, and write it like this: pattern = re.compile(r'[|]' r'ID=' r'[a-z]*' r'[0-9]*' r'[a-z]*' r'[0-9]*' r'[a-z]*' r'[|]' ) -- https://mail.python.org/mailman/listinfo/python-list
Re: Regular Expression for the special character "|" pipe
On 27/05/2014 12:39, Aman Kashyap wrote: On Tuesday, 27 May 2014 16:59:38 UTC+5:30, Daniel wrote: What about skipping the re and try this: 'start=|ID=ter54rt543d|SID=ter54rt543d|end=|'.split('|')[1][3:] On 27.05.2014 14:09, Vlastimil Brom wrote: 2014-05-27 12:59 GMT+02:00 Aman Kashyap : I would like to create a regular expression in which i can match the "|" special character too. e.g. start=|ID=ter54rt543d|SID=ter54rt543d|end=| I want to only |ID=ter54rt543d| from the above string but i am unable to write the pattern match containing "|" pipe too. By default python treat "|" as an OR operator. But in my case I want to use to as a part of search string. -- Hi, you can just escpape the pipe with backlash like any other metacharacter: r"start=\|ID=ter54rt543d" be sure to use the raw string notation r"...", or you can double all backslashes in the string. hth, vbr Thanks for the response. I got the answer finally. This is the regular expression to be used:\\|ID=[a-z]*[0-9]*[a-z]*[0-9]*[a-z]*\\| I'm pleased to see that you have answers. In return would you please use the mailing list https://mail.python.org/mailman/listinfo/python-list or read and action this https://wiki.python.org/moin/GoogleGroupsPython to prevent us seeing double line spacing and single line paragraphs, thanks. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com -- https://mail.python.org/mailman/listinfo/python-list
Re: is there a list/group for beginners?
Hi, Deb. Ten years ago (or eleven?), I was completely new to Python. I could not begin to understand over 90 percent of what I was reading here in comp.lang.python. Still, I asked my newbie questions here. For the most part, I got excellent responses. I think you're in the right place. -- https://mail.python.org/mailman/listinfo/python-list
Re: Python is horribly slow compared to bash!!
On 2014-05-26, Dennis Lee Bieber wrote: > On Mon, 26 May 2014 19:00:11 +0200, Johannes Bauer > declaimed the following: > >> >>Now let's all code Itanium assembler, yes? > > Naw... Let's beg Intel to bring back the iAPX-432, and beg AdaCore to > port GNAT to it. When the '432 datasheets came out, everybody thought it was pretty cool. Turns out it just didn't "go". So, Intel lowered its sights and concentrated on the 8086 family, and we all suffered for the next few decades as a result... -- Grant Edwards grant.b.edwardsYow! I smell like a wet at reducing clinic on Columbus gmail.comDay! -- https://mail.python.org/mailman/listinfo/python-list
Re: hashing strings to integers
On 2014-05-23, Chris Angelico wrote: > On Fri, May 23, 2014 at 8:27 PM, Adam Funk wrote: >> I've also used hashes of strings for other things involving >> deduplication or fast lookups (because integer equality is faster than >> string equality). I guess if it's just for deduplication, though, a >> set of byte arrays is as good as a set of int? > > Want a better way to do that? Use a set or dict and let Python do the > hashing. It'll be every bit as fast as explicit hashing, plus you get > the bonus of simplicity. Well, here's the way it works in my mind: I can store a set of a zillion strings (or a dict with a zillion string keys), but every time I test "if new_string in seen_strings", the computer hashes the new_string using some kind of "short hash", checks the set for matching buckets (I'm assuming this is how python tests set membership --- is that right?), then checks any hash-matches for string equality. Testing string equality is slower than integer equality, and strings (unless they are really short) take up a lot more memory than long integers. So for that kind of thing, I tend to store MD5 hashes or something similar. Is that wrong? -- With the breakdown of the medieval system, the gods of chaos, lunacy, and bad taste gained ascendancy. --- Ignatius J Reilly -- https://mail.python.org/mailman/listinfo/python-list
Re: hashing strings to integers
On 2014-05-23, Terry Reedy wrote: > On 5/23/2014 6:27 AM, Adam Funk wrote: > >> that. The only thing that really bugs me in Python 3 is that execfile >> has been removed (I find it useful for testing things interactively). > > The spelling has been changed to exec(open(...).read(), ... . It you use > it a lot, add a customized def execfile(filename, ... to your site > module or local utils module. Are you talking about this? https://docs.python.org/3/library/site.html Is there a dummies/quick-start guide to using USER_SITE stuff? -- No sport is less organized than Calvinball! -- https://mail.python.org/mailman/listinfo/python-list
python
Need of python in embedded systems??? -- https://mail.python.org/mailman/listinfo/python-list
Re: hashing strings to integers
On Tue, 27 May 2014 16:13:46 +0100, Adam Funk wrote: > On 2014-05-23, Chris Angelico wrote: > >> On Fri, May 23, 2014 at 8:27 PM, Adam Funk >> wrote: >>> I've also used hashes of strings for other things involving >>> deduplication or fast lookups (because integer equality is faster than >>> string equality). I guess if it's just for deduplication, though, a >>> set of byte arrays is as good as a set of int? >> >> Want a better way to do that? Use a set or dict and let Python do the >> hashing. It'll be every bit as fast as explicit hashing, plus you get >> the bonus of simplicity. > > Well, here's the way it works in my mind: > >I can store a set of a zillion strings (or a dict with a zillion >string keys), but every time I test "if new_string in seen_strings", >the computer hashes the new_string using some kind of "short hash", >checks the set for matching buckets (I'm assuming this is how python >tests set membership --- is that right?), So far so good. That applies to all objects, not just strings. >then checks any >hash-matches for string equality. Testing string equality is slower >than integer equality, and strings (unless they are really short) >take up a lot more memory than long integers. But presumably you have to keep the string around anyway. It's going to be somewhere, you can't just throw the string away and garbage collect it. The dict doesn't store a copy of the string, it stores a reference to it, and extra references don't cost much. As for string equality, in pseudo-code it looks something like this: def __eq__(self, other): # Consider only the case where other is a string as well. if self is other: # object identity return True if len(self) != len(other): # checking the length is fast return False # iterate over both strings in lock-step for a in self, b in other: if a != b: return False return True only written in fast C code. So the equality test bails out as quickly as possible, and the only time you have to look at every character is if the two strings are equal but not the same object. MD5 hashing, on the other hand, *always* has to look at every character, and perform quite a complicated set of computations. It's expensive. > So for that kind of thing, I tend to store MD5 hashes or something > similar. Is that wrong? First rule of optimization: Don't do it. Second rule of optimization (for experts only): Don't do it yet. You're making the cardinal mistake of optimization, not what is slow, but what you *assume* will be slow. (Or, replace memory consumption for speed if you prefer.) Python is not C, and your intuitions for what's fast and slow (low and high memory consumption) are likely to be way off. Consider trying to store an MD5 hash instead of the string "Hello World!". If I try this in Python 2.7, I get this: py> import md5, sys py> s = "Hello World!" py> n = int(md5.md5(s).hexdigest(), 16) py> sys.getsizeof(s) 33 py> sys.getsizeof(n) 30 I save a lousy 3 bytes. But in order to save that 3 bytes, I have to generate an md5 object (32 bytes) and a hex string (53 bytes), both of which take time to create and then time to garbage collect. Actually, I don't even save those 3 bytes, since for nearly all reasonable applications, I'll need to keep the string around somewhere. So instead of saving three bytes, it's costing me thirty bytes for the hash, plus who-knows-what needed to manage the book keeping to link that hash to the actual string. Ah, but maybe we can save time hashing them? py> from timeit import Timer py> setup = "from __main__ import s, n" py> t1 = Timer("hash(s)", setup) py> t2 = Timer("hash(n)", setup) py> min(t1.repeat(5)) 0.14668607711791992 py> min(t2.repeat(5)) 0.15973114967346191 Times are in seconds for one million iterations of the code being timed. Or alternatively, it costs about 0.14 microseconds to hash the string, and about 0.15 microseconds to hash the MD5 hash. **Not** to calculate the MD5 hash in the first place, that takes *much* longer: py> t3 = Timer("md5.md5(s).hexdigest()", "import md5; s = 'Hello World!'") py> min(t3.repeat(5)) 2.3326950073242188 but merely to perform a lightweight hash on the long int so as to find which bucket of the dict it belongs to. So, yes, chances are **very** good that you're supposed optimizations in this area are actually pessimizations. If you have not measured where the bottlenecks in your code are, you have no idea which parts of the code need to be optimized. Now, it is conceivable that there may be some circumstances where your strategy makes sense. I'm guessing you would need something like this before you even come close to saving memory and/or time: - rather than short keys like "Hello World!", you are dealing with keys that are typically many tens of thousands of characters long; - most of the strings are the same length
Re: hashing strings to integers
On Wed, May 28, 2014 at 3:02 AM, Steven D'Aprano wrote: > But I know that Python is a high-level language with > lots of high-level data structures like dicts which trade-off time and > memory for programmer convenience, and that I'd want to see some real > benchmarks proving that my application was too slow before giving up that > convenience with a complicated strategy like this. And they trade off that time and memory on the basis of X years of development expertise. A while ago (about ten years or so, now... wow, that's quite a while) I wrote a C++ program that needed an ever-growing array; for simplicity, I went with a very basic system of doubling the size every time, from a base of something like 1024 or 8192. (Note that it was storing and moving around only pointers, so it's comparable to Python's list.) That means it has an average 25% slack space at all times, more until its first allocation, and every now and then it has a huge job of copying a pile of pointers into a new array. (Imagine it's now at 16777216 and it needs to add the 16,777,217th string to the array. Bye-bye CPU caches.) These boundaries became *user-visible pauses*, fortunately at predictable points, but on a not-terrible computer it could cause a >1s pause just copying heaps of pointers. How do you think a Python list will perform, under the same workload (periodic appending of single strings or small groups of strings, very frequent retrieval based on index - probably about a 20:1 read:write ratio)? Not only would it be far more convenient, it's probably going to outperform my hand-rolled code - unless I'm so brilliant (or lucky) that I can stumble to something as good as can be achieved with years of dedicated development. Yeah, I don't think so. Same goes for hashing algorithms. I can at least boast that I've never written one of those... although I have several times written a binary tree of one form or another, in order to provide comparable features to a dict. And once again, now that I know how convenient and performant high level languages can be (which may or may not have been true 15 years ago, but I certainly didn't know it), I don't rewrite what can be done better by just tossing in a couple of curly braces and saying "here, map this to that". ChrisA -- https://mail.python.org/mailman/listinfo/python-list
help with memory leak
I'm trying to track down a memory leak in a fairly large code. It uses a lot of numpy, and a bit of c++-wrapped code. I don't yet know if the leak is purely python or is caused by the c++ modules. At each iteration of the main loop, I call gc.collect() If I then look at gc.garbage, it is empty. I've tried using objgraph. I don't know how to interpret the result. I don't know if this is the main leakage, but I see that each iteration there are more 'Burst' objects. If I look at backrefs to them using this code: for frame in count(1): ## main loop starts here gc.collect() objs = objgraph.by_type('Burst') print(objs) if len (objs) != 0: print(objs[0], gc.is_tracked (objs[0])) objgraph.show_backrefs(objs[0], max_depth=10, refcounts=True) I will get a graph like that attached A couple of strange things. The refcounts (9) of the Burst object don't match the number of arrows into it. There are 2 lists with 0 refs. Why weren't they collected?-- https://mail.python.org/mailman/listinfo/python-list
Re: Hello and sorry for disturbing !
Rustom Mody writes: > For ubuntu you should need nothing for python. > In other words python should run on a basic ubuntu installation. > From the shell just type python and the interpreter should start. > > For more specialized work there are dozens (maybe hundreds?) of > packages in the apt repos. % apt-cache show python Display all 2776 possibilities? (y or n) -- https://mail.python.org/mailman/listinfo/python-list
Re: Hello and sorry for disturbing !
I recommend to install PyCharm -- https://mail.python.org/mailman/listinfo/python-list
Re: Hello and sorry for disturbing !
I recommend you to install PyCharm -- https://mail.python.org/mailman/listinfo/python-list
Re: Hello and sorry for disturbing !
I recommend you to install PyCharm -- https://mail.python.org/mailman/listinfo/python-list
Re: Hello and sorry for disturbing !
On Wed, May 28, 2014 at 5:56 AM, giacomo boffi wrote: > Rustom Mody writes: > >> For ubuntu you should need nothing for python. >> In other words python should run on a basic ubuntu installation. >> From the shell just type python and the interpreter should start. >> >> For more specialized work there are dozens (maybe hundreds?) of >> packages in the apt repos. > > % apt-cache show python > Display all 2776 possibilities? (y or n) Not quite fair, as some of those exist in multiple forms (python-* and python3-*, or -dbg and -dev as well as the base package, or the package-and-subpackage model of large stuff like python-django-*), and on Debian Wheezy I have only (only!) 1890. But yep, that is a lot of packages available in apt. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: help with memory leak
On Wed, May 28, 2014 at 5:56 AM, Neal Becker wrote: > I'm trying to track down a memory leak in a fairly large code. It uses a lot > of > numpy, and a bit of c++-wrapped code. I don't yet know if the leak is purely > python or is caused by the c++ modules. Something to try, which would separate the two types of leak: Run your program in a separate namespace of some sort (eg a function), make sure all your globals have been cleaned up, run a gc collection, and then see if you still have a whole lot more junk around. If that cleans everything up, it's some sort of refloop; if it doesn't, it's either a global you didn't find, or a C-level refleak. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Python box (home-use smart router)
On 2014-05-27 15:33, animalize81 wrote: > Home-use smart router is more and more popular. > > If embeds Python into such router, and > develops a framework that has the following features: > > 1, allow power-down at any time > 2, dynamic domain name > 3, local storage support (SD cards or Hard Disk) > 4, telnet server > etc. > > Then we can create micro private server on it. It certainly can. I've got a Buffalo router here that runs a stripped-down version of Linux and has Python installed on it. No need for the PSF to get involved because people are already creating these without them. I know that a lot of folks use an old router and put OpenWRT, DD-WRT, or Tomato firmware on them. This would give you a Linux platform on which you can install Python, usually telnet (or more likely, SSH) support, and can be integrated with a number of dynamic-DNS services. You could even grab a Raspberry Pi (model B with ethernet), add a USB ethernet adaptor, and you'd have a pretty nice machine with 512MB of RAM (the router platforms don't usually have more than ~64MB of RAM), two ethernet ports for routing, and would support SD or USB drives. -tkc -- https://mail.python.org/mailman/listinfo/python-list
Re: Hello and sorry for disturbing !
On 27/05/2014 21:02, maksu...@gmail.com wrote: I recommend to install PyCharm Three copies in three minutes of one line with no context, that's a record, congratulations :) -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com -- https://mail.python.org/mailman/listinfo/python-list
Re: python
On 2014-05-27 08:43, himanshul...@gmail.com wrote: > Need of python in embedded systems??? Define "embedded". I've got a couple small low-powered devices here (a Digi ConnectPort, a Raspberry Pi, a low-end 32-bit system with 32MB of RAM) all of which run Python. It might be trickier if you're talking about some super low-end hardware where you don't have a memory management unit, a full-fledged OS. -tkc -- https://mail.python.org/mailman/listinfo/python-list
Re: is there a list/group for beginners?
> -Original Message- > From: john_lada...@sbcglobal.net > Sent: Tue, 27 May 2014 11:38:39 -0700 (PDT) > To: python-list@python.org > Subject: Re: is there a list/group for beginners? > > Hi, Deb. > > Ten years ago (or eleven?), I was completely new to Python. I could not > begin to understand over 90 percent of what I was reading here in > comp.lang.python. Still, I asked my newbie questions here. For the most > part, I got excellent responses. I think you're in the right place. > -- > https://mail.python.org/mailman/listinfo/python-list thanks,John. I guess I was/am afraid to embarrass myself on this list, but then I accidentally posted a question meant for the tutor list and ended up getting more for my money than I expected :). I really appreciate that the people on this list are so friendly and willing to help. FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop! Check it out at http://www.inbox.com/earth -- https://mail.python.org/mailman/listinfo/python-list
Re: is there a list/group for beginners?
On Wed, May 28, 2014 at 7:38 AM, Deb Wyatt wrote: > thanks,John. I guess I was/am afraid to embarrass myself on this list, but > then I accidentally posted a question meant for the tutor list and ended up > getting more for my money than I expected :). I really appreciate that the > people on this list are so friendly and willing to help. > Asking "newbie questions" isn't going to get you flamed here, we're pretty friendly :) Anyway, we're all newbies in whatever areas we haven't actually dug into. (I denewbified myself in Flask just last week, and there's plenty more of Python that I've never touched.) So go for it, ask those questions! Reveal your ignorance. Let us reveal ours, as we make errors in responses. And by the end of the thread, all the errors will have been corrected and the ignorance cured... and we'll all have learned. That, in my books, is a recipe for an awesome thread. Bring it on! ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Command prompt not shown when running Python script with subprocess on Windows
Sorry for not being explicit enough. I am aware that this would work if I called python.exe path-to-script.py with shell=False. In my Python program, I parse an XML file like the one I have included below. Then I loop through the paths of the apps listed in it and run them by calling something like this: for app_path in app_paths: args = shlex.split(app_path.replace("\\", "")) args = [arg.replace("", "\\") for arg in args] args[0] = os.path.expandvars(args[0]) subprocess.Popen(args, shell='__WXMSW__' in wx.PlatformInfo) I want users to be able to enter paths in the XML file exactly the way they would be entered in a Windows shortcut. Since it is possible to make a Windows shortcut for path-to-script.py without the python.exe in front of it and have it open in its own command prompt, I want to be able to do the same thing in my XML file, but this is what I cannot figure out. By the way, is there a simpler way to use shlex.split and return valid Windows paths than the way I am doing (as shown above)? Thank you. -- Timothy *** Contents of app_list.xml below *** %ProgramFiles%\Mozilla Firefox\firefox.exe %ProgramFiles%\Mozilla Thunderbird\thunderbird.exe %ProgramFiles%\LibreOffice 4\program\swriter.exe "C:\Users\Timothy\Documents\myfile.odt" C:\Users\Timothy\Documents\Python\myscript.py -- https://mail.python.org/mailman/listinfo/python-list
Re: hashing strings to integers
On Tue, 27 May 2014 17:02:50 +, Steven D'Aprano wrote: > - rather than "zillions" of them, there are few enough of them that > the chances of an MD5 collision is insignificant; > (Any MD5 collision is going to play havoc with your strategy of > using hashes as a proxy for the real string.) > - and you can arrange matters so that you never need to MD5 hash a > string twice. Hmmm... I'll use the MD5 hashes of the strings as a key, and the strinsgs as the value (to detect MD5 collisions) ... (But I'm sure that Steven was just waiting for someone to take that bait...) -- https://mail.python.org/mailman/listinfo/python-list
Re: Command prompt not shown when running Python script with subprocess on Windows
On 28/05/2014 00:01, ps16thypresenceisfullnessof...@gmail.com wrote: I want users to be able to enter paths in the XML file exactly the way they would be entered in a Windows shortcut. Since it is possible to make a Windows shortcut for path-to-script.py without the python.exe in front of it and have it open in its own command prompt, I want to be able to do the same thing in my XML file, but this is what I cannot figure out. Anything done through shortcuts is making use of the Windows Shell API. To mimic that behaviour, you could try using that; in this case, ShellExecute[Ex]. For simple purposes, this is exposed in Python as os.startfile. If you need more control, you'd have to use the API call directly, either via ctypes or via the pywin32 libraries under the win32com.shell package. To mimic the behaviour exactly (if that is a requirement), you could actually create a temporary shortcut with the desired information and invoke it via os.startfile. I haven't followed the thread (and I'm offline at the moment) so I'll wait until I've seen it before I comment on the shlex.split / \\ dance above. On the surface, though, I'm not sure what it's achieving. [All right, I didn't wait :)]. TJG -- https://mail.python.org/mailman/listinfo/python-list