Re: py2exe questions
Doug Stell wrote: > I have 2 questions about py2exe or any similar utility. > > 1. Is it possible to create a single Windows executable that does not > blow out to a folder full of files and can be called from scripts > using command line arguments? py2exe can most certainly do this. > > 2. If the above can be done, it is possible to hide parts of the > Python source code from users? These users are software developers, > but we don't want them to see how the code does what it does. > > thanks, doug you can make a single exe in py2exe which would make it harder to disassemble, but there's no such thing in the software world that makes it impossible. -- http://mail.python.org/mailman/listinfo/python-list
Re: python GUIs comparison (want)
Mudcat wrote: > I have been using Tkinter for several years now. Recently I have been > thinking about switching to something else that may have a sharper > appearance. However I'm not sure what that may be, and if that > something else is *that* much better than what I'm already using. > > Does everyone agree that wxPython looks best on Windows? I've also read > in a couple of places where Dabo looks pretty good as well. > > So if someone were to pick a UI that gave the best appearance, what > would they choose? > > i've been using wxpython for a few years and it's great. it's got far better widgets then tkinter and it's speed is greater on large stuff as well. it's got a great support forum and the maintainer robin dunn does a great job of answering all questions. i can't particularly fault wxpython. it looks great on all platforms and maintain the native look and feel of the platofrm as well. -- http://mail.python.org/mailman/listinfo/python-list
Re: python GUIs comparison (want)
Mudcat wrote: > When you say far better widgets, do you mean that it has a greater > number of widgets to choose from, or that the types of widgets are > basically the same but have a greater amount of flexibility in them? by better i mean more of them to choose from and the functionality they provide. when i started working with wx i discovered widgets i hadn't even seen before. and if you can't find a widget to suit, it's easy to make one. -- http://mail.python.org/mailman/listinfo/python-list
SPE editor slow?
hello i've been using the SPE editor on a moderately large project and it's constantly pausing during editing, like it's attempting to check something as i edit. as you can imagine a 4 second pause every few characters is EXTREMELY annoying when you just want to get some work done. i really like SPE's layout and features but if it's going to be dogshit slow all the time i'll have to change. please help! -- http://mail.python.org/mailman/listinfo/python-list
Re: SPE editor slow?
SPE - Stani's Python Editor wrote: > timmy schreef: > > >>hello i've been using the SPE editor on a moderately large project and >>it's constantly pausing during editing, like it's attempting to check >>something as i edit. >>as you can imagine a 4 second pause every few characters is EXTREMELY >>annoying when you just want to get some work done. i really like SPE's >>layout and features but if it's going to be dogshit slow all the time >>i'll have to change. please help! > > > SPE does error syntax checking which works fine for normal sized python > files. With these settings you can speed up SPE for larger projects: > 1. Edit>Preferences>Editor: Check realtime with "none" (default value: > compiler) > 2. Edit>Preferences>Editor: Update sidebar "when clicked" > > You can first try step 1, if you want SPE faster, use step 2 as well. > > Stani > thanks stani i actually had an incling that 2. was the real problem. i've got probably 200 or so clases in my project and it was pausing mainly when it came to names of things or a . i changed it to on clicked and it's fine now. it still does something else though that i'm at a loss to fix. when i open a file or run a script is throws up errors saying "Failed to display HTML document in ISO-8859-1 encoding" i guess thats a problem with those bottom info windows? -- http://mail.python.org/mailman/listinfo/python-list
opening excel
Hello, has anybody got any experience opening and manilpulating excel spreedsheets via python? it seems pythoncom allows this to happen but i'm a total newb to it. (i usually work in the unix world) all i need to do, is open the xls files and read values from it. -- http://mail.python.org/mailman/listinfo/python-list
Re: opening excel
John Machin wrote: > timmy wrote: > >>Hello, >> >>has anybody got any experience opening and manilpulating excel >>spreedsheets via python? it seems pythoncom allows this to happen but >>i'm a total newb to it. (i usually work in the unix world) >>all i need to do, is open the xls files and read values from it. > > > If you really mean "read" rather than "manipulate", have a look at the > xlrd package (of which I'm the author). > > http://www.python.org/pypi/xlrd > > BTW, it's pure Python; you can run it on your unix box if you like :-) > > Cheers, > John > sweet thats what i'd like to do -- http://mail.python.org/mailman/listinfo/python-list
SPE bug?
i can't paste from SPE into an xterm window. is this problem with SPE? -- http://mail.python.org/mailman/listinfo/python-list
deleteing item from a copy of a list
i make a copy of a list, and delete an item from it and it deletes it from the orginal as well, what the hell is going on?!?!?! #create the staff copy of the roster Roster2 = [] for ShiftLine in Roster: #delete phone number from staff copy Roster2.append(ShiftLine) del Roster2[len(Roster2)-1][1] Roster2 should have nothing to do with Roster, right??? doing a print of both lists confirms that the phone number has been removed from both -- http://mail.python.org/mailman/listinfo/python-list
Re: Secure Python
Steven D'Aprano wrote: > On Thu, 16 Nov 2006 04:02:58 +0100, Fredrik Tolf wrote: > > >>Hi List! >> >>I was thinking about secure Python code execution, and I'd really >>appreciate some comments from those who know Python better than I do. >> >>I was thinking that maybe it could be possible to load and run untrusted >>Python code, simply by loading it in a module with a modified version of >>__builtins__. Without any reachable function that do unsafe operations, >>code running from there shouldn't be able to do evil things. > > > How would you prevent a Denial Of Service attack like this? > > # don't try this at home kids! leave this to the professionals! > n = 1**4 > L = [] > for i in range(n): > L.append(str(2L**n)) > > Here's an interesting one. Bug or deliberate attack? > > > def evens(): > # iterator returning even numbers > i = 0 > while True: > yield i > i += 2 > # now get all the even numbers up to 15 > L = [n for n in evens() if n < 15] > > > congraulations you have discovered loops and their misuse -- http://mail.python.org/mailman/listinfo/python-list
Re: Secure Python
Fredrik Lundh wrote: > timmy wrote: > >> congraulations you have discovered loops and their misuse > > > if you don't know what the phrase "denial of service attack" means, you > can always google for it. > > > maybe you should google "linux kernel limit" and you can prevent any user/process maxing out your system -- http://mail.python.org/mailman/listinfo/python-list
Re: Secure Python
Steven D'Aprano wrote: > On Thu, 16 Nov 2006 17:44:37 +1000, timmy wrote: > > >>congraulations you have discovered loops and their misuse > > > Did you have a point in your utterly inane comment, or did you just want > to see your name on Usenet? > > In any case, it isn't just "loops" that are dangerous. > > print 2**512**512 > > No loop there, but it will operate as a lovely DoS attack if you run it. > > The Original Poster is suggesting running UNTRUSTED code. That means you > have to assume that it will be actively hostile, but even if it isn't > deliberately hostile, there will be bugs which the developer can't control. > > He wants to run this untrusted (hostile or buggy or both) code in an > environment where it can't do bad things. "Bad things" include Denial of > Service attacks. So, Timmy, let's hear your brilliant scheme for > preventing DoS attacks when running hostile code in Python. > > > as posted before, linux kernel limit. then you and your users can go as crazy as you want and you won't take out your system. maybe you should think a little more before going on the attack like that. -- http://mail.python.org/mailman/listinfo/python-list
Re: Secure Python
Fredrik Lundh wrote: > timmy wrote: > >> maybe you should google "linux kernel limit" and you can prevent any >> user/process maxing out your system > > > one would have thought that the phrase "apart from OS-specific stuff" > might have meant that the OP wasn't asking for Linux-specific solutions. > > > sorry i didn't see that. cpu and memory limiting aren't specific to linux though, any NT system can also do it. the only effective way to prevent someone with access to a compiler from performing a local dos on your system is use each os's resource controls. there's no cross platform way to do this, since every system has vastly different methods of memory and cpu time handling. This looks like a case where he will just have to accept this as a trade off (security is always a trade off) -- http://mail.python.org/mailman/listinfo/python-list
Re: Secure Python
Stephan Kuhagen wrote: > timmy <"timothy at open-networks.net"> wrote: > > This sub-thread starts to become a flame-war, isn't it? Calm down, both of > you... No need to fight, when only some ideas for a technical question are > requested. i'm not fighting, sometimes i can be a little terse for that i aplogise. > > >>as posted before, linux kernel limit. >> >>then you and your users can go as crazy as you want and you won't take >>out your system. > > > The problem with linux kernel limits are, that they won't work really good > on MacOSX and Windows... OTOH the idea is the right one, but the effect can > be achieved inside of Python. Since Python does byte compile the code and > the interpreter evaluates each byte code token in one evaluation step. The > interpreter could be extended for such usecases to count and limit the > number of evaluation steps allowed for untrusted script or methods in > untrusted script as well as to limit the recursion depth or memory to be > allocated. idunno sounds like a lot of trouble to engineer a solution that has already got a solution. all win NT systems have resource managment and i imagine OS X would as well?? > > Regards > Stephan > -- http://mail.python.org/mailman/listinfo/python-list
Re: Secure Python
Diez B. Roggisch wrote: >>as posted before, linux kernel limit. >> >>then you and your users can go as crazy as you want and you won't take >>out your system. >> >>maybe you should think a little more before going on the attack like that. > > > You should maybe read a little bit more when making bold statements about > the feasibility of a sandboxed _PYTHON_. The OP wrote: > there is nothing preventing you putting limits on the resources each process uses, on just about any modern day OS > At least to me - and I presume pretty much everybody except you in this > thread - Oh no i understand perfectly what he wants, i merely suggest a simple OS based solution. this means that he is interested in executing arbitrary pieces of > python code inside the interpreter, which comes from e.g. players who > customize their in-game behavior of their avatars. > > Now how exactly does linux (or any other resource limiting technique on any > OS) help here - killing the whole game server surely isn't a desirable > solution when one player goes berserk, might it be intentionally or not. resource managment does not kill anything it merely prevents one process running away and consuming the whole server. this is EXACTLY what he is afraid of. if he intends on running arbitrary code then i suggest he spawns each one as a seperate thread with a spefic name and merely set limits on all processes named X. that way he can run any whacky code he wants safely inside those processes without fear of any one of them crashing the server. I know it can be done under any of the nix's, I'm not sure how to do so under windows, but it could probably be done. > > It is a recurring and pretty much understandable request on c.l.py to be > able to do so - sometimes it arises in the disguise of killable threads. > But unfortunately the solution doesn't seem to be as simple as one would > wish. i can understand people wanting an application based cross platform solution to this, but i'm yet to see anything practicle hence i suggest and OS based solution. > > Diez -- http://mail.python.org/mailman/listinfo/python-list
Re: Secure Python
Paul Boddie wrote: > Diez B. Roggisch wrote: > > > [Multiplayer game servers] > > >>Now how exactly does linux (or any other resource limiting technique on any >>OS) help here - killing the whole game server surely isn't a desirable >>solution when one player goes berserk, might it be intentionally or not. > > And this is where the hot topics collide: people want performant > multitasking with lots of shared state (the global interpreter lock > controversy) together with sandboxing so that the individual threads > can't access most of that shared state (the restricted execution > controversy). i'm not talking about sandboxing, that's a whole different kettle of fish. i'm talking about resource managment options you can set in for instance, the linux kernel. you can limit the cpu and memory a process uses while still allowing it the same access it would have outside of a sandbox. that way if any clever monkeys try to dos you they merely consume their alloted quota. -- http://mail.python.org/mailman/listinfo/python-list
How to know more about an exception?
Hi, I has a question about exception in python. I know that an exception can be re-raised. Is there any simple way provided by python itself that I can know the current exception is just firstly occurred or it is re-raised by previous exception? I need to know whether the exception is firstly occurred or not because I want to just display an error message if it's firstly occur and skip display error message if it is just re-raised by previous exception. Thanks! -- http://mail.python.org/mailman/listinfo/python-list
Inexplicable Urllib2 problem between virtualenv's when POSTing to a Tomcat server
Hey, I have a question on Stackoverflow at the moment that I thought I would
put up here as it might get some more eyes (It has a bounty so feel free to
answer there if you have a SO account!)
I have some test code (as a part of a webapp) that uses urllib2 to perform an
operation I would usually perform via a browser:
- Log in to a remote website (this works)
- Move to another page (this works)
- Perform a POST by filling in a form (read on ...!)
I've created 4 separate, clean virtualenvs (with --no-site-packages) on 3
different machines, all with different versions of python but the exact same
packages (via pip requirements file), and the code only works on the two
virtualenvs on my local development machine(2.6.1 and 2.7.2) - it won't work on
either of my production VPSs :(
In the failing cases, I can log in successfully, move to the correct page but
when I submit the form, the remote server replies telling me that there has
been an error - it's an application server error page ('we couldn't complete
your request') and not a webserver error.
- because I can successfully log in and maneuver to a second page, this doesn't
seem to be a session or a cookie problem - it's particular to the final POST
- because I can perform the operation on a particular machine with the EXACT
same headers and data, this doesn't seem to be a problem with what I am
requesting/posting
- because I am trying the code on two separate VPS rented from different
companies, this doesn't seem to be a problem with the VPS physical environment
- because the code works on 2 different python versions, I can't imagine it
being an incompabilty problem
I'm completely lost at this stage as to why this wouldn't work. I've even
'turned-it-off-and-turn-it-on-again' because I just can't see what the problem
could be.
I've tried everything I can think of to get this working. I've been through all
of the headers of the requests & responses and they are all the same between
machines.
The server I am trying to contact is a Tomcat server. It gives me a cookie
called JSESSIONID and it also requires an apache.struct.token in the POST data
which I am succesfully extracting with BeautifulSoup/lxml. Again, this works on
2 machines, so I don't think it's an ommision on my behalf, I think it's a
compatibility or an encoding error.
Any ideas welcome!
--
http://mail.python.org/mailman/listinfo/python-list
Re: Inexplicable Urllib2 problem between virtualenv's when POSTing to a Tomcat server
Good point. The two machines that the code works with are running python 2.6.1 and 2.7.2 and are running on my Mac (Snow Leopard) The two non-working machines are running python 2.6.6 and 2.7.1 and are on Debian 6 and Debian 5 respectively. They are VPSs managed by different providers. All of the installs are on separate virtuaenvs. -- http://mail.python.org/mailman/listinfo/python-list
