Gimp-Python
Salve, qualcuno sa se è ancora in fase di sviluppo e qual'è il sito di riferimento? Grazie Danilo -- Using Opera's revolutionary e-mail client: http://www.opera.com/m2/ -- http://mail.python.org/mailman/listinfo/python-list
Configuration: Apache + mod_python
Hi there, is it possible to create a rewrite rule to send every server-request to the directory /py? But only if the file does not exists on the server. This is my mod_python section of the apache config-file. SetHandler python-program PythonHandler django.core.handlers.modpython PythonPath "['/var/www/mydomain.com/htdocs/py'] + sys.path" SetEnv DJANGO_SETTINGS_MODULE myapp.settings PythonDebug Off Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Re: Configuration: Apache + mod_python
On 8 Mrz., 12:18, [EMAIL PROTECTED] wrote:
> On Mar 8, 9:50 pm, "Danilo" <[EMAIL PROTECTED]> wrote:
>
> > Hi there,
>
> > is it possible to create a rewrite rule to send every server-request
> > to the directory /py? But only if the file does not exists on the
> > server.
>
> > This is my mod_python section of the apache config-file.
>
> >
> > SetHandler python-program
> > PythonHandler django.core.handlers.modpython
> > PythonPath "['/var/www/mydomain.com/htdocs/py'] + sys.path"
> > SetEnv DJANGO_SETTINGS_MODULE myapp.settings
> > PythonDebug Off
> >
>
> For the more general case of where a HTTP 404 error would otherwise be
> returned, indicating that a resource could not be found, as opposed to
> an actual physical file, you can just use:
>
> ErrorDocument 404 /py
>
> This would be simpler than using mod_rewrite. I can't remember though
> whether the handler when triggered in this case can change the
> response status to something other than 404.
>
> You could use mod_rewrite if you really must, but not sure how it
> would interact with virtual resources managed by some handler where no
> actual file exists. To be practical you would probably want to
> restrict the scope of mod_rewrite to specific contexts.
>
> Quoting an example from very good book "The Definitive Guide to Apache
> mod_rewrite", you can do something similar to:
>
> RewriteEngine On
> # If its not here ...
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteCond %{REQUEST_FILENAME} !-d
> # Look here instead ...
> RewriteRule ^/images/(.*) /pics/$1 [PT]
>
> In this case it is causing lookups for images to be made in two
> places, but your case wouldn't be much different.
>
> Graham
The rewrite rule works, but now every request ist send to /py.
This is my .conf:
DocumentRoot /var/www/mydomain.com/htdocs
ServerName mydomain.com
ServerAlias www.mydomain.com
SetHandler python-program
PythonHandler django.core.handlers.modpython
PythonPath "['/var/www/mydomain.com/htdocs/py'] + sys.path"
SetEnv DJANGO_SETTINGS_MODULE myapp.settings
PythonDebug Off
RewriteEngine On
# If its not here...
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Look here instead...
RewriteRule (.*) /py$1 [PT]
ErrorLog /var/www/mydomain.com/logs/error.log
CustomLog /var/www/mydomain.com/logs/access.log common
Any ideas what is wrong?
--
http://mail.python.org/mailman/listinfo/python-list
Re: Configuration: Apache + mod_python
On 8 Mrz., 22:23, [EMAIL PROTECTED] wrote:
> On Mar 9, 12:02 am, "Danilo" <[EMAIL PROTECTED]> wrote:
>
>
>
> > On 8 Mrz., 12:18, [EMAIL PROTECTED] wrote:
>
> > > On Mar 8, 9:50 pm, "Danilo" <[EMAIL PROTECTED]> wrote:
>
> > > > Hi there,
>
> > > > is it possible to create a rewrite rule to send every server-request
> > > > to the directory /py? But only if the file does not exists on the
> > > > server.
>
> > > > This is my mod_python section of the apache config-file.
>
> > > >
> > > > SetHandler python-program
> > > > PythonHandler django.core.handlers.modpython
> > > > PythonPath "['/var/www/mydomain.com/htdocs/py'] + sys.path"
> > > > SetEnv DJANGO_SETTINGS_MODULE myapp.settings
> > > > PythonDebug Off
> > > >
>
> > > For the more general case of where a HTTP 404 error would otherwise be
> > > returned, indicating that a resource could not be found, as opposed to
> > > an actual physical file, you can just use:
>
> > > ErrorDocument 404 /py
>
> > > This would be simpler than using mod_rewrite. I can't remember though
> > > whether the handler when triggered in this case can change the
> > > response status to something other than 404.
>
> > > You could use mod_rewrite if you really must, but not sure how it
> > > would interact with virtual resources managed by some handler where no
> > > actual file exists. To be practical you would probably want to
> > > restrict the scope of mod_rewrite to specific contexts.
>
> > > Quoting an example from very good book "The Definitive Guide to Apache
> > > mod_rewrite", you can do something similar to:
>
> > > RewriteEngine On
> > > # If its not here ...
> > > RewriteCond %{REQUEST_FILENAME} !-f
> > > RewriteCond %{REQUEST_FILENAME} !-d
> > > # Look here instead ...
> > > RewriteRule ^/images/(.*) /pics/$1 [PT]
>
> > > In this case it is causing lookups for images to be made in two
> > > places, but your case wouldn't be much different.
>
> > > Graham
>
> > The rewrite rule works, but now every request ist send to /py.
> > This is my .conf:
>
> >
> > DocumentRoot /var/www/mydomain.com/htdocs
> > ServerName mydomain.com
> > ServerAliaswww.mydomain.com
>
> >
> > SetHandler python-program
> > PythonHandler django.core.handlers.modpython
> > PythonPath "['/var/www/mydomain.com/htdocs/py'] + sys.path"
> > SetEnv DJANGO_SETTINGS_MODULE myapp.settings
> > PythonDebug Off
> >
>
> > RewriteEngine On
> > # If its not here...
> > RewriteCond %{REQUEST_FILENAME} !-f
> > RewriteCond %{REQUEST_FILENAME} !-d
> > # Look here instead...
> > RewriteRule (.*) /py$1 [PT]
>
> > ErrorLog /var/www/mydomain.com/logs/error.log
> > CustomLog /var/www/mydomain.com/logs/access.log common
> >
>
> > Any ideas what is wrong?
>
> I did say you would probably need to restrict the scope of the
> mod_rewrite rule to a specific context. In particular, put it inside
> of a Directory directive corresponding to the file system directory
> where your files live. Where you have it as the moment,
> REQUEST_FILENAME probably will not resolve to anything as Apache
> hasn't yet matched it to the filesystem. Thus:
>
>
>
> RewriteEngine On
> # If its not here...
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteCond %{REQUEST_FILENAME} !-d
> # Look here instead...
> RewriteRule (.*) /py$1 [PT]
>
>
>
> Graham
Thank you.
the RewriteCond just needs the absolute path:
RewriteEngine On
# If its not here...
RewriteCond /var/www/btsgroup.de/htdocs/%{REQUEST_FILENAME} !-f
RewriteCond /var/www/btsgroup.de/htdocs/%{REQUEST_FILENAME} !-d
# Look here instead...
RewriteRule (.*) /py$1 [PT]
Thanks
dan
--
http://mail.python.org/mailman/listinfo/python-list
Re: Python Behind a Squid Corporate Proxy on Windows
Hi,
do you manage to go through the proxy? I'm having the same problem
with error 407. I've tried many solutions from the web but it always
show the same error. So, if you solved your problem, please, post it
here.
Thanks
Danilo
On 18 jul, 15:43, Larry Hale <[EMAIL PROTECTED]> wrote:
> Thank you so much for the reply, but alas: I get the same results.
> (urllib2 makes the initial request,Squidreplies "Error 407:Proxy
> Authentication Required", which urllib2 dutifully fails on/raises said
> error...)
>
> I do appreciate your time, though! :)
> -Larry
>
> On Jul 18, 3:08 am, Chris <[EMAIL PROTECTED]> wrote:
>
> > On Jul 17, 6:40 pm, Larry Hale <[EMAIL PROTECTED]> wrote:
>
> > > Err, the line above should be:
>
> > > proxy_handler = urllib2.ProxyHandler( { "http": "http://
> > > myusername:[EMAIL PROTECTED]:3128" } )
>
> > > (Sorry! :)
>
> > some old code I wrote to download public domain info for our company,
> > also through asquidproxyand this still works for me
>
> > import urllib2, urllib
>
> >proxy= urllib2.ProxyHandler({'http': 'http://
> > username:[EMAIL PROTECTED]:proxy_port'})
> > auth = urllib2.HTTPBasicAuthHandler()
> > opener = urllib2.build_opener(proxy, auth, urllib2.HTTPHandler)
> > urllib2.install_opener(opener)
>
> > conn = urllib2.urlopen('http://python.org')
> > return_str = conn.read()
>
> > fp = open('python.html','w').write(return_str)
--
http://mail.python.org/mailman/listinfo/python-list
Re: Python3-3.7.3: cannot run pdb
Il 07/06/2019 19:31, Rich Shepard ha scritto:
> On Fri, 7 Jun 2019, MRAB wrote:
>
>> It's possible that the error is actually on the previous line and that it
>> thinks that what's on line 35 is a continuation of what's on line 34, but
>> it isn't.
>
> MRAB,
>
> If that's the case I'm missing seeing the error. Here are the lines
> prior to
> and including line 36:
>
> def __init__(self, parent, *args, **kwargs):
> super().__init__(parent, *args, **kwargs)
> # A dict to keep track of input widgets
> self.inputs = {}
>
> # line 0
> self.inputs['name'] = LabelInput(
> self, 'Site Name',
> input_var=tk.StringVar(),
> )
> self.inputs['name'].grid(sticky=tk.W, row=0, column=0)
>
> self.inputs['date'] = LabelInput(
> self, 'Sample Date',
> input_var=tk.StringVar(),
> )
> self.inputs['date'].grid(row=0, column=1)
>
> self.inputs['medium'] = LabelInput(
> self, 'Medium',
> med = tk.StringVar()
^^^
Missing a comma here!
> boxchoices = ttk.Combobox(self, textvariable=med,
> values=['Storm water', 'Surface water',
> 'Ground water', 'Sediments',
> 'Soils'])
> )
>
> emacs shows all parentheses are paired. I hope that fresh eyeballs see what
> I keep missing.
>
> Regards,
>
> Rich
>
--
https://mail.python.org/mailman/listinfo/python-list
Re: join and split with empty delimiter
Il 18/07/2019 12:27, Ben Bacarisse ha scritto:
> Irv Kalb writes:
>
>> I have always thought that split and join are opposite functions. For
>> example, you can use a comma as a delimiter:
>>
> myList = ['a', 'b', 'c', 'd', 'e']
> myString = ','.join(myList)
> print(myString)
>> a,b,c,d,e
>>
> myList = myString.split(',')
> print(myList)
>> ['a', 'b', 'c', 'd', 'e']
>>
>> Works great.
>
> Note that join and split do not always recover the same list:
>
','.join(['a', 'b,c', 'd']).split(',')
> ['a', 'b', 'c', 'd']
>
> You don't even have to have the delimiter in one of the strings:
>
'//'.join(['a', 'b/', 'c']).split('//')
> ['a', 'b', '/c']
>
>> But i've found a case where they don't work that way. If
>> I join the list with the empty string as the delimiter:
>>
> myList = ['a', 'b', 'c', 'd']
> myString = ''.join(myList)
> print(myString)
>> abcd
>>
>> That works great. But attempting to split using the empty string
>> generates an error:
>>
> myString.split('')
>> Traceback (most recent call last):
>> File "", line 1, in
>> myString.split('')
>> ValueError: empty separator
>>
>> I know that this can be accomplished using the list function:
>>
> myString = list(myString)
> print(myString)
>> ['a', 'b', 'c', 'd']
>>
>> But my question is: Is there any good reason why the split function
>> should give an "empty separator" error? I think the meaning of trying
>> to split a string into a list using the empty string as a delimiter is
>> unambiguous - it should just create a list of single characters
>> strings like the list function does here.
>
> One reason might be that str.split('') is not unambiguous. For example,
> there's a case to be made that there is a '' delimiter at the start and
> the end of the string as well as between letters. '' is a very special
> delimiter because every string that gets joined using it includes it!
> It's a wild version of ','.join(['a', 'b,c', 'd']).split(',').
>
> Of course str.split('') could be defined to work the way you expect, but
> it's possible that the error is there to prompt the programmer to be
> more explicit.
>
It is even more ambiguous if you consider that any string starts with an
infinite number of empty strings, followed by a character, followed by
an infinite number of empty strings, followed by ...
The result wouldn't fit on screen, or in memory for that!
--
https://mail.python.org/mailman/listinfo/python-list
Re: FW: Pycharm Won't Do Long Underscore
Il 30/06/2020 23:46, Joe Pfeiffer ha scritto: > "Peter J. Holzer" writes: > >> On 2020-06-24 15:33:16 -0600, Joe Pfeiffer wrote: >>> One other note -- while you may want various good-looking fonts with >>> ligatures in other domains, for writing code a monospace font with no >>> ligatures lets you see exactly what's there and saves a host of >>> problems. My personal favorite for these purposes is called "Terminus >>> Regular", but which specific one you pick is much less important than >>> that you use one. >> >> I agree. Although there are some fonts with special ligatures for >> programming. I have never used one, but that seems like an interesting >> concept. > > I've never heard of that before. I'd be curious to try one. > I've been using this one, and I like it: https://github.com/tonsky/FiraCode https://www.fontsquirrel.com/fonts/fira-code Works well with PyCharm. -- https://mail.python.org/mailman/listinfo/python-list
Re: lambdak: multi-line lambda implementation in native Python
Il 17/01/2015 12.07, Marko Rauhamaa ha scritto: > Jussi Piitulainen : > >> a+ b => 7 # a() + b >> a +b => 3 # a(+b) => a(b) => a(1) = 1 + 2 >> >> I'm not quite fond of such surprise in programming language syntax. > > Yes, whoever came up with the idea of whitespace having syntactic > significance! > > > Marko > Maybe you already knew this "esoteric" language: http://compsoc.dur.ac.uk/whitespace/ https://en.wikipedia.org/wiki/Whitespace_%28programming_language%29 And, just for completeness :) http://www.stroustrup.com/whitespace98.pdf -- https://mail.python.org/mailman/listinfo/python-list
