PyOBEX installation problem

2020-09-22 Thread Johny
I tried to install PyOBEX

see the log  below

C:\Users\expor\Downloads\OBEX>setup.py install
running install
running bdist_egg
running egg_info
writing PyOBEX.egg-info\PKG-INFO
writing top-level names to PyOBEX.egg-info\top_level.txt
writing dependency_links to PyOBEX.egg-info\dependency_links.txt
reading manifest file 'PyOBEX.egg-info\SOURCES.txt'
writing manifest file 'PyOBEX.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
creating build
creating build\lib
creating build\lib\PyOBEX
copying PyOBEX\client.py -> build\lib\PyOBEX
copying PyOBEX\common.py -> build\lib\PyOBEX
copying PyOBEX\headers.py -> build\lib\PyOBEX
copying PyOBEX\requests.py -> build\lib\PyOBEX
copying PyOBEX\responses.py -> build\lib\PyOBEX
copying PyOBEX\server.py -> build\lib\PyOBEX
copying PyOBEX\__init__.py -> build\lib\PyOBEX
creating build\bdist.win-amd64
creating build\bdist.win-amd64\egg
creating build\bdist.win-amd64\egg\PyOBEX
copying build\lib\PyOBEX\client.py -> build\bdist.win-amd64\egg\PyOBEX
copying build\lib\PyOBEX\common.py -> build\bdist.win-amd64\egg\PyOBEX
copying build\lib\PyOBEX\headers.py -> build\bdist.win-amd64\egg\PyOBEX
copying build\lib\PyOBEX\requests.py -> build\bdist.win-amd64\egg\PyOBEX
copying build\lib\PyOBEX\responses.py -> build\bdist.win-amd64\egg\PyOBEX
copying build\lib\PyOBEX\server.py -> build\bdist.win-amd64\egg\PyOBEX
copying build\lib\PyOBEX\__init__.py -> build\bdist.win-amd64\egg\PyOBEX
byte-compiling build\bdist.win-amd64\egg\PyOBEX\client.py to client.pyc
byte-compiling build\bdist.win-amd64\egg\PyOBEX\common.py to common.pyc
byte-compiling build\bdist.win-amd64\egg\PyOBEX\headers.py to headers.pyc
byte-compiling build\bdist.win-amd64\egg\PyOBEX\requests.py to requests.pyc
byte-compiling build\bdist.win-amd64\egg\PyOBEX\responses.py to responses.pyc
byte-compiling build\bdist.win-amd64\egg\PyOBEX\server.py to server.pyc
byte-compiling build\bdist.win-amd64\egg\PyOBEX\__init__.py to __init__.pyc
creating build\bdist.win-amd64\egg\EGG-INFO
copying PyOBEX.egg-info\PKG-INFO -> build\bdist.win-amd64\egg\EGG-INFO
copying PyOBEX.egg-info\SOURCES.txt -> build\bdist.win-amd64\egg\EGG-INFO
copying PyOBEX.egg-info\dependency_links.txt -> 
build\bdist.win-amd64\egg\EGG-INFO
copying PyOBEX.egg-info\top_level.txt -> build\bdist.win-amd64\egg\EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating dist
creating 'dist\PyOBEX-0.29-py2.7.egg' and adding 'build\bdist.win-amd64\egg' to 
it
removing 'build\bdist.win-amd64\egg' (and everything under it)
Processing PyOBEX-0.29-py2.7.egg
Copying PyOBEX-0.29-py2.7.egg to c:\python27\lib\site-packages
Adding PyOBEX 0.29 to easy-install.pth file

but still I can not use it. See

>>> from PyOBEX.client import BrowserClient
Traceback (most recent call last):
  File "", line 1, in 
ImportError: No module named PyOBEX.client
>>>

Where can be a problem?
Thank you for help




-- 
https://mail.python.org/mailman/listinfo/python-list


I2C protocol

2015-08-18 Thread Johny
Is there any library for I2C protocol so that I can control a device connected 
to Windows?
-- 
https://mail.python.org/mailman/listinfo/python-list


How to solve this problem

2011-08-09 Thread Johny
I have a client that  is a part of a local network.This client has a
local address( not public).Is there a way how I can connect to this
client from outside world?
What software must I install so that I can connect and control that
client from outside?

Thanks

B
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Control webbrowser from Python script

2010-10-09 Thread Johny
On Oct 9, 5:17 pm, Tim Harig  wrote:
> On 2010-10-09, Johny  wrote:
>
> > Is it possible to control any webbrowser from Python ? For example to
> > issue http POST and GET  command
>
> The most reliable way to interact with a webserver is through the urllib
> and httplib modules.  This is effective for 99% of cases.  I do understand
> that some sites heavy in javascript can be difficult to figure out how to
> make valid requests.  On win32 you can automate Internet Explorer through
> its InternetExplorer.Application COM interface which is fully documented at
> the MSDN site.  On other operating systems, Firefox can be accessed using
> its XPCOM interface.

Thanks ALL who replied.I wanted to use directly  httplib modul and I
started with it.But webserver uses SSL communication.
Of course, I can use https protocol but the communication between
server and  client( browser) is so complicated that I was unable to
simulate that with python script.So I think I could do that with
webbrowser directly ( control webbrowser from a python script)
-- 
http://mail.python.org/mailman/listinfo/python-list


Control webbrowser from Python script

2010-10-09 Thread Johny
Is it possible to control any webbrowser from Python ? For example to
issue http POST and GET  command
Thanks
Johny
-- 
http://mail.python.org/mailman/listinfo/python-list


Smtpd module

2010-04-23 Thread Johny
I would like to use smtpd module to write very simple smtp server but
this server must:

1. accept several connections at the same time( like a forking server)
2. have basic authentication  that is it must understand AUTH command.

Does anyone know if the smtpd module have both?
Thanks

Ba.
-- 
http://mail.python.org/mailman/listinfo/python-list


Does a tiny Python distribution exist?

2010-03-25 Thread Johny
Does anyone know if there is a tiny Python distribution available
running in a Linux environment?
-- 
http://mail.python.org/mailman/listinfo/python-list


How to find the best solution ?

2010-03-23 Thread Johny
I have a text and would like  to split the text into smaller parts,
say into 100 characters each. But if  the 100th character is not a
blank ( but word) this must be less than 100 character.That means the
word itself can not be split.
These smaller parts must contains only whole( not split) words.
I was thinking  about  RegEx but do not know how to find the correct
Regular Expression.
Can anyone help?
Thanks
L.
-- 
http://mail.python.org/mailman/listinfo/python-list


What is pkg-config for ?

2010-03-19 Thread Johny
Can anyone explain what is pkg-config  for?ANd how can I find it in
Windows?
Thanks
-- 
http://mail.python.org/mailman/listinfo/python-list


pkg-config and Windows

2010-03-17 Thread Johny
I have a program that needs to be installed with setup.py. But there
is a problem when I am trying to install the program with setup.py in
Windows. When I try to install with

python setup.py install
it goes like this

C:\>python setup.py install
 running install
 running build
 running build_py
 running build_ext
 ERROR: Could not find pkg-config!

As you can see
the installation finishes with the error:
Could not find pkg-config!

Is there any way how to find out pkg-config in Windows?
or how to solve the problem?
Thanks
L.

-- 
http://mail.python.org/mailman/listinfo/python-list


Python bindings tutorial

2010-03-16 Thread Johny
Is there any tutorial how to write a bindings for a exe ( dos)
program?
I would like to run it from a Python directly
( using import command and a particular function from the binding)
 not using os.system command.
Thanks
L.
-- 
http://mail.python.org/mailman/listinfo/python-list


Import problem

2010-03-06 Thread Johny
I have this directory structure

C:
  \A
 __init__.py
 amodule.py

 \B
  __init__.py
  bmodule.py

   \D
__init__.py
dmodule.py

and  I want to import  bmodule.py
C:\>cd \

C:\>python
Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit
(Intel)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> from A.B import  bmodule
I am bmodule
>>>
C:\>

so far so good. Now I would like to import bmodule but if the current
directory is \D subdirectory.

C:> cd \A\B\D
C:\A\B\D>
C:\A\B\D>python
Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit
(Intel)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path.append('C:\\A')
>>> from A.B import bmodule
Traceback (most recent call last):
  File "", line 1, in 
ImportError: No module named A.B

C:\>

so I can not import a module from the parent directory? Or where did I
make an error?
Thanks for help

L.
-- 
http://mail.python.org/mailman/listinfo/python-list


Decorators

2009-03-06 Thread Johny
Hi,
Can anyone explain to me what are decorators for? What are advantages
of using them?
Thanks
L.
--
http://mail.python.org/mailman/listinfo/python-list


Re: ssh problem using paramiko?

2008-10-07 Thread Johny
On Oct 7, 2:40 pm, sa6113 <[EMAIL PROTECTED]> wrote:
> I use this code :
>
> import paramiko
> import socket
>
> hostname = "192.168.1.4"
> username = "test"
> port = 22
> password = ''123456"
>
> # now connect
> try:
> sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
> sock.connect((hostname, port))
> except Exception, e:
> print 'Connect failed: ' + str(e)
> traceback.print_exc()
> sys.exit(1)
>
> --
> and I got this error :
> sock.connect((hostname, port))
> File "", line 1 , in  connect
> error:(10061 ,'Connection refused')
> ---
> what is the problem?
> I have a computer with this Ip and username , password in my network.
> Do I have to install ssh or somthing else in that computer(server) or run
> any script?
>
> --
> View this message in 
> context:http://www.nabble.com/ssh-problem-using-paramiko--tp19857268p19857268...
> Sent from the Python - python-list mailing list archive at Nabble.com.

Why do not use only Paramiko

import paramiko

t = paramiko.Transport((Myserver, 22))
t.start_client()
t.auth_password(Login,'Password)

chan = t.open_session()



--
http://mail.python.org/mailman/listinfo/python-list


Processes in Linux from Python

2008-08-31 Thread Johny
To get a number of  the http processes running on my Linux( Debia box)
I use
ps -ef | grep "[h]ttpd" | wc -l

But If I want to use to get a number of the http processes from my
Python program I must use  a popen command e.g.
popen2.popen3('ps -ef | grep "[h]ttpd" | wc -l')
that is I must call an external  command from Python.

But it creates a zombie.
So my question is:
Is it possible to get a number of the http processes running on Linux
directly from Python ?

Thanks for help.
L.
--
http://mail.python.org/mailman/listinfo/python-list


Is there a such Python module ?

2008-07-30 Thread Johny
Is there a Python module that can help with reading SMS message from a
mobile phone?
Or is there an example how to read SMS message using a program written
in Python,C, or any other language?
Thank you very much for help
L.
--
http://mail.python.org/mailman/listinfo/python-list


Python program as daemon?

2008-07-25 Thread Johny
Is it possible to run a Python program as daemon?
Thanks
--
http://mail.python.org/mailman/listinfo/python-list


How to find processes from Python

2008-07-25 Thread Johny
Is there a way how to find out  running processes?E.g. how many
Appache's processes are running?
Thanks for help.
BB.
--
http://mail.python.org/mailman/listinfo/python-list


How to find the first space?

2008-06-09 Thread Johny
How can I find the first space using regex?

For example I have text
Text=' This is a sample '

The last space I can remove by
Text=re.sub(r"\s(?!\w)",'',Text)

but I do not know how to remove the first space.
Can anyone help?

Thanks
L.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Dbase / foxpro files

2008-05-17 Thread Johny
Thanks for your reply.Is it possible to delete a record by using the
module?
Thanks
L>
--
http://mail.python.org/mailman/listinfo/python-list


Re: Dbase / foxpro files

2008-05-15 Thread Johny
On May 15, 5:21 pm, John Machin <[EMAIL PROTECTED]> wrote:
> Johny wrote:
> > Is there a module for reading/modifing db files from Python?
> > Thanks for help
> > B.
>
> I have a module -- which I'm going to get around to releasing one of
> these days :-) -- which allows to read dBase III, dBase IV and Foxpro
> files (sequentially only, not randomly) and to write dBaseIII files
> sequentially. Index files if any are ignored.
>
> Field types supported for reading:
> C character
> D date
> F float
> I integer (32 bits)
> L logical
> M memo (stored in a .DBT (dBase) or .FPT (FoxPro) file)
> N number
> T time
>
> Writing supports only dBaseIII with C, D, L and N fields, but could be
> extended easily enough (I've never had the need). No index files are
> written.
>
> E-mail me if you are interested.
>
> Cheers,
> John

Hello John,
Yes, I am interested. Is it possible to download the module?
Thanks
Lad
--
http://mail.python.org/mailman/listinfo/python-list


Dbase / foxpro files

2008-05-15 Thread Johny
Is there a module for reading/modifing db files from Python?
Thanks for help
B.
--
http://mail.python.org/mailman/listinfo/python-list


Re: How to split string

2007-12-05 Thread Johny
Thank you all who replied particularly Chris and Tim.
L.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to split string

2007-12-05 Thread Johny
On Dec 5, 11:55 am, Chris <[EMAIL PROTECTED]> wrote:
> On Dec 5, 10:55 am, Johny <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > I have a string of a variable length and I need to split the string
> > in strings of 6 characters .
> > But if the 6th character is not space then I must split the string
> > at possition  before the 6th character.
>
> > For example:
> > if the main string  S is
>
> > S='abcde fghc ijkl mnop'
>
> > the result should be
> > abcde
> > fghc
> > ijkl
> > mnop
>
> > Do you have any idea how it can be done?
> > Thank you
> > L.
>
> That's not a great example of what you are looking for, because that
> result just looks like:
> '\n'.join(S.split())
>
> What result would you be looking for with say:
> S='this is just a random sequence of letters courtesy of monkeys on
> typewriter.'

Chris,
Thank you for your reply.
So, let's suppose the  example:
S='this is just a random sequence of letters courtesy of monkeys on
typewriter.'
and the length of split strings is now 10( instead of 6)
The example should be like this
this is
just a
random
sequence
of letters
courtesy
of monkeys
on
typewriter


In other words, the string should be split at every 10th possition but
if the 10th character is space, then the string must be split at the
nearest space before the 10th possition.

It could be better explained if the length of split strings will be
20.

S='this is just a random sequence of letters courtesy of monkeys on
> typewriter.'

Results:

this is just a
random sequence of
letters courtesy of
monkeys on
typewriter.'


Any idea how to do that?
Thank you
L.




-- 
http://mail.python.org/mailman/listinfo/python-list


How to split string

2007-12-05 Thread Johny
I have a string of a variable length and I need to split the string
in strings of 6 characters .
But if the 6th character is not space then I must split the string
at possition  before the 6th character.

For example:
if the main string  S is

S='abcde fghc ijkl mnop'

the result should be
abcde
fghc
ijkl
mnop


Do you have any idea how it can be done?
Thank you
L.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Standalone USB Web Server and Python Interpeter

2007-12-05 Thread Johny
Or you can look at
http://www.portablepython.com/
L.
-- 
http://mail.python.org/mailman/listinfo/python-list


Image treshold

2007-11-10 Thread Johny
Can anyone give me an example how to apply a threshold value to an
image?

(everything above a certain brightness level becomes white, and
everything below the
 level becomes black.)

I was told I should use 256-item mapping table and pass it to the
"point" method.

But how should the 256-item mapping table  look like, if the threshold
is 18( found from the histogram)


Thank you for any hint.
L.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Help for Otsu implementation from C

2007-11-07 Thread Johny
On Sep 22, 6:24 pm, azrael <[EMAIL PROTECTED]> wrote:
> Thanks Man, I did it. It works fantastic.
>
Can you please posted the working Python implementation of the Otsu
filter .
Thanks
L.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What colour model does the image use in PIL

2007-11-07 Thread Johny
On Nov 7, 2:53 pm, Hrvoje Niksic <[EMAIL PROTECTED]> wrote:
> Johny <[EMAIL PROTECTED]> writes:
> > I use PIL and with it im.getpixel((x,y)) to find out the colour of a
> > pixel.  But how can I find out in which color model the the return
> > value is?
>
> im.mode gives you a string such as 'RGBA' or 'CMYK'.  im.getbands()
> returns a tuple such as ('R', 'G', 'B', 'A').

Thank you for your help.
Can you please help me once more?
Now I would need to apply a threshold value to the image, where
everything above a certain brightness level becomes white, and
everything below the level becomes black.
How can I do that with PIL?
Thank you
L

-- 
http://mail.python.org/mailman/listinfo/python-list


What colour model does the image use in PIL

2007-11-07 Thread Johny
I use PIL and with it  im.getpixel((x,y)) to find out the colour of a
pixel.
But how can I find out in which color model  the  the  return value
is?

For example  for png picture format

im.getpixel((20,50))  gives the result 60.

What does the value mean?
Is it possible to find out the RGB model values?

Thank you for help.
L.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Readline and record separator

2007-10-31 Thread Johny
On Oct 30, 8:44 pm, Bruno Desthuilliers
<[EMAIL PROTECTED]> wrote:
> Johny a écrit :
>
> > Is it possible to change record separator when using readline?
> > As far as I know readline reads characters until found '\n' and it is
> > the end of record for readline.
>
> This is not a "record" separator, but a newline. As the name implies,
> file.readline is about reading a text file line by line. For a
> definition of "line" being : "a chuk of text that starts either at the
> beginning of the document or after a newline" and for a definition of
> "newline" being "a platform-specific character or character sequence".
>
> > My problem is that my record consits several '\n' and when I use
> > readline it does NOT read the whole my record.
> > So If I could change '\n' as  a record separator for readline, it
> > would solve my problem.
> > Any idea?
>
> If you're dealing with (so-called) CSV files, you might want to have a
> look at the (oh surprise) CSV module (in the stdlib) instead.
>
> HTH

Bruno,
Thank you for your hint, but can you please be more specific when
saying
"look at the (oh surprise) CSV module (in the stdlib)" ?
Thanks
L

-- 
http://mail.python.org/mailman/listinfo/python-list

Readline and record separator

2007-10-30 Thread Johny
Is it possible to change record separator when using readline?
As far as I know readline reads characters until found '\n' and it is
the end of record for readline.
My problem is that my record consits several '\n' and when I use
readline it does NOT read the whole my record.
So If I could change '\n' as  a record separator for readline, it
would solve my problem.
Any idea?
Thank you
L.

-- 
http://mail.python.org/mailman/listinfo/python-list


How to find imported modules

2007-10-16 Thread Johny
My Main program imports several other smaller programs.
for example
Main.py
imports
Program1.py
Program2.py
...
Program50.py

Now I need to find out which  of Programs imports a particular module
- module timesocket.py
Is that possible without opening each program?
Thanks
B.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python and SSL

2007-10-04 Thread Johny
On Oct 5, 3:50 am, John Nagle <[EMAIL PROTECTED]> wrote:
> Johny wrote:
> > Martin and John,
> > Thank you both for your replies
> >  Must I  have OpenSSL imported in my Python program?
> > So far I have been using only SSL  support.
> > Built-in SSL support works OK if I connect from my Python program
> > directly to SSL server ( but not via proxy).
> > L.
>
>  SSL isn't SUPPOSED to work through proxies.  That's the whole point of
> SSL - to prevent somebody in the middle from tapping into the connection.
> Look up "man in the middle attack".
>
>  
John,
SSL may not be SUPPOSED to work through proxies but it CAN work.
JAVA is  an example. But I would like to use  Python instead of Java.
And because I have not been  able to make it  I asked here about
OpenSSL.
Regards,
L.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python and SSL

2007-10-04 Thread Johny
Martin and John,
Thank you both for your replies
 Must I  have OpenSSL imported in my Python program?
So far I have been using only SSL  support.
Built-in SSL support works OK if I connect from my Python program
directly to SSL server ( but not via proxy).
L.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python and SSL

2007-10-03 Thread Johny
On Oct 3, 2:17 pm, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote:
> > It looks like this
>
> > MyPythonProgram --->Proxy>Server
> > The  proxy is written in Java. I want to use that proxy to see what my
> > Python program sends to server.
> > The proxy uses its own certificate and this certificate must be
> > trusted, I think, otherwise I receive an error.
>
> What error do you receive precisely? Please copy it literally from
> the terminal, don't rephrase it.
>
After I added certification, that the proxy uses, among those
Trusted Root Certification Authorities list,as
Gabriel described on Windows,

I receive
sslerror: (1, 'error:140770FC:SSL
routines:SSL23_GET_SERVER_HELLO:unknown protocol')


What does it mean?
Thanks.
L

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python and SSL

2007-10-03 Thread Johny
On Oct 3, 7:51 am, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote:
> > a  certificate that is signed by OpenSSL's own CA( certification
> > authority), that is not recognized in the program's list of root CAs,
> > causes an exception to be raised.
>
> What is "the program"? What programming language is it written in?
> What library does it use to maintain a list of root CAs, and what
> code does it execute to find out that a certificate is not in this
> list?
>
> Are you sure this is related to Python at all?
Martin,
Thank you for your reply.

It looks like this

MyPythonProgram --->Proxy>Server
The  proxy is written in Java. I want to use that proxy to see what my
Python program sends to server.
The proxy uses its own certificate and this certificate must be
trusted, I think, otherwise I receive an error.

If I use
InternetBrowser --->Proxy>Server

browser asks me if the Proxy's certificate is trusted.If I reply  YES,
than communication continues( I think browser adds this certificate
among trusted ones)

So, can you help, please?
Thanks.
L.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python and SSL

2007-10-02 Thread Johny
Thank you all for your replies.
I am still a newbie with SSL issues but I found out that:
a  certificate that is signed by OpenSSL's own CA( certification
authority), that is not recognized in the program's list of root CAs,
causes an exception to be raised.
(That is a different behaviour from the built-in SSL.)
So, my question again,
how can I add a certification to the list of root CAs?
Thanks for help
L.



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python and SSL

2007-10-01 Thread Johny
On Oct 1, 4:31 pm, Paul Rubin <http://[EMAIL PROTECTED]> wrote:
> Johny <[EMAIL PROTECTED]> writes:
> > By using my Python program I am  attempting to trust a certificate
> > signed by a certification authority that Python doesn't trust and that
> > causes the error.
>
> No, as Martin points out, Python trusts EVERY certificate, which of
> course misses the whole point of certificates.  Whatever is making
> your program fail is something different.

Paul, are you sure for 100%. It is hard to belive.
In Java it is possible so I would expect that to be possible in Python
too.
L.


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python and SSL

2007-10-01 Thread Johny
On Sep 28, 11:13 pm, Heikki Toivonen <[EMAIL PROTECTED]> wrote:
> Johny wrote:
> > I need to use Python with SSL comunication betweeen servers.
> > (I use hhtplib but I think urllib2 can also be used )
> >  I think I need to use SSL root certificate and tell  a program to
> > trust this certificate.
>
> You can't do secure SSL with the builtin SSL support, you need to use a
> third party module. There are a few available, including M2Crypto, TLS
> Lite, pyOpenSSL and pyOpenSSL-extended. Since I am the maintainer

Thank you all for help
I probably put my question in  a wrong way.
So again:
For the purpose of the  application debugging I would like to know
how  to add a new
certification authority to Python( so that  my Python program will
accept that certificate).
By using my Python program I am  attempting to trust a certificate
signed by a certification authority that Python doesn't trust and that
causes the error.
Thanks for help.
L.


-- 
http://mail.python.org/mailman/listinfo/python-list


How to unload a module after I've imported it.

2007-09-29 Thread Johny
Is it possible to unload a module after I've imported it.
I have the main program from which I import several smaller programs.
Some of these uses timeoutsocket module.
But one of the smaller program can not work with the timeoutsocket
module, so I must
unload the timeoutsocket module, execute the program and  then  reload
timeoutsocket module.
So, s it possible to unload a module after I've imported it..
Thanks
L.

-- 
http://mail.python.org/mailman/listinfo/python-list


Python and SSL

2007-09-27 Thread Johny
I need to use Python with SSL comunication betweeen servers.
(I use hhtplib but I think urllib2 can also be used )
 I think I need to use SSL root certificate and tell  a program to
trust this certificate.
But how can I tell my Python program to trust my SSL certificate?
When I tried  before I received the error 503
Thank you for help
L,

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: HTTPS request

2007-09-25 Thread Johny
On Sep 25, 6:17 pm, Larry Bates <[EMAIL PROTECTED]> wrote:
> Johny wrote:
> > If I need to log in to a site using https protocol must I use
> > certification file and key file?
> > The class HTTPSConnection syntax is
> > class HTTPSConnection( host[, port, key_file, cert_file])
>
> > and I do not know if it is nescessary or not.
> > Thanks for help.
> > L.
>
> Depends on what the server requires.  You can do basic authenticate to a 
> https:
> site if it supports it.
>
> -Larry

Hello Larry,
Thanks for your reply.
I had to register on this site, so I have Login and Password.
I can log in to the site through normal process on the server(by
filling in the login form).
But I can not login to the site from my Python program.
I use the same procedure as I do for other webservers that require
login information. The only difference is that the server, this time,
is HTTPS server.
So I do not know if I must use a SSL certificate or not and if I can
use HTTP 1.0 or I must use HTTP 1.1 protocol.
Any idea?
Thanks
L.

-- 
http://mail.python.org/mailman/listinfo/python-list


HTTPS request

2007-09-25 Thread Johny
If I need to log in to a site using https protocol must I use
certification file and key file?
The class HTTPSConnection syntax is
class HTTPSConnection( host[, port, key_file, cert_file])

and I do not know if it is nescessary or not.
Thanks for help.
L.

-- 
http://mail.python.org/mailman/listinfo/python-list


How to get headers in urllib2 response

2007-09-15 Thread Johny
Can anyone provide an example how to find out the return code and
header  from an urllib2 request?
For example
response = urllib2.urlopen('http://www.google.com').read().strip()
provides data
 but I do not know if the return code was 200 or different.

Thanks

-- 
http://mail.python.org/mailman/listinfo/python-list


Https conversation - debug?

2007-09-14 Thread Johny
Is there any good sniffer for https protocol?
How can be watched https conversation?

Thanks for reply
L.

-- 
http://mail.python.org/mailman/listinfo/python-list


How to create a file with read access rights

2007-06-21 Thread Johny
Is  it possible to  create a file on Linux  with access rights?
For example
 owner can read and write into the file
others can only read from the file
Thanks for replies
L.

-- 
http://mail.python.org/mailman/listinfo/python-list


WebThumb

2007-06-15 Thread Johny
How can I get a website thumbnail?
I would like to allow visitors to add their URLs  to our pages with
the thumbnail of their website.
Can anyone suggest a solution for web thumbnails?
Thanks
L.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: httpd: Syntax error on line 54

2007-05-23 Thread Johny
On May 22, 8:57 am, deepak <[EMAIL PROTECTED]> wrote:
> I installed apache 2.2.4 and modPython 3.3.1 on Fc6
>  while starting the apache server the following error occurs:
>
> httpd: Syntax error on line 54 of /usr/local/apache2/conf/httpd.conf:
> Cannot load /usr/local/apache2/modules/mod_python.so into server: /usr/
> local/apache2/modules/mod_python.so: cannot restore segment prot after
> reloc: Permission denied
>
> help  plz

Can Apache start wo/mod_python?
If so, check mod_python( permissions) installation

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to replace the last (and only last) character in a string?

2007-05-03 Thread Johny
On May 3, 4:37 pm, [EMAIL PROTECTED] wrote:
> On May 3, 9:27 am, Johny <[EMAIL PROTECTED]> wrote:
>
> > Let's suppose
> > s='12345 4343 454'
> > How can I replace the last '4' character?
> > I tried
> > string.replace(s,s[len(s)-1],'r')
> > where 'r' should replace  the last '4'.
> > But it doesn't work.
> > Can anyone explain why?
>
> > Thanks
> > L.
>
> I think the reason it's not working is because you're doing it kind of
> backwards. For one thing, the "string" module is deprecated. I would
> do it like this:
>
> s = s.replace(s[len(s)-1], 'r')
>
> Although that is kind of hard to read. But it works.
>
> Mike


Mike it does NOT work for me.
>>> s.replace(s[len(s)-1], 'r')
'123r5 r3r3 r5r'

I need only the last character to be replaced


-- 
http://mail.python.org/mailman/listinfo/python-list


How to replace the last (and only last) character in a string?

2007-05-03 Thread Johny
Let's suppose
s='12345 4343 454'
How can I replace the last '4' character?
I tried
string.replace(s,s[len(s)-1],'r')
where 'r' should replace  the last '4'.
But it doesn't work.
Can anyone explain why?

Thanks
L.

-- 
http://mail.python.org/mailman/listinfo/python-list


How to find complementary colour for pixel

2007-04-26 Thread Johny
 I use PIL to write some text to a picture.The text must  be seen wery
clearly.
I write the text to different pictures but to the same position. As 
pictures maybe  different, colour, in the position where I write the
text, is also different.
Is there a way how to set the font colour so that it will be seen very
clearly in the picture?
For example, if the picture is bright ( for example yellow), the font
colour should be dark( e.g. black) and vice versa.
Is there a routine in PIL available  that calculates complementary
colour for RGB pixel format?
Can anyone help?
Thanks
L.

-- 
http://mail.python.org/mailman/listinfo/python-list


How to set font colour in PIL

2007-04-24 Thread Johny
 I use PIL to write some text to a picture.The text must  be seen wery
clearly.
I write the text to different pictures but to the same position. As
pictures maybe  different, colour, in the position where I write the
text, is also different.
Is there a way how to set the font colour so that it will be seen very
clearly in the picture?
For example, if the picture is bright ( for example yellow), the font
colour should be dark( e.g. black) and vice versa.
Can anyone help?
Thanks
L.

-- 
http://mail.python.org/mailman/listinfo/python-list


PIL and font colours.

2007-04-24 Thread Johny
 I use PIL to write some text to a picture.The text must  be seen wery
clearly.
I write the text to different pictures but to the same position. As
pictures maybe  different, colour, in the position where I write the
text, is also different.
Is there a way how to set the font colour so that it will be seen very
clearly in the picture?
For example, if the picture is bright ( for example yellow), the font
colour should be dark( e.g. black) and vice versa.
Can anyone help?
Thanks
L.

-- 
http://mail.python.org/mailman/listinfo/python-list


PIL and font colours.

2007-04-24 Thread Johny
 I use PIL to write some text to a picture.The text must  be seen wery
clearly.
I write the text to different pictures but to the same position. As
pictures maybe  different, colour, in the position where I write the
text, is also different.
Is there a way how to set the font colour so that it will be seen very
clearly in the picture?
For example, if the picture is bright ( for example yellow), the font
colour should be dark( e.g. black) and vice versa.
Can anyone help?
Thanks
L.

-- 
http://mail.python.org/mailman/listinfo/python-list


PIL and font colour

2007-04-24 Thread Johny
 I use PIL to write some text to a picture.The text must  be seen wery
clearly.
I write the text to different pictures but to the same position. As
pictures maybe  different, colour, in the position where I write the
text, is also different.
Is there a way how to set the font colour so that it will be seen very
clearly in the picture?
For example, if the picture is bright ( for example yellow), the font
colour should be dark( e.g. black) and vice versa.
Can anyone help?
Thanks
L.

-- 
http://mail.python.org/mailman/listinfo/python-list


PIL and font colour

2007-04-24 Thread Johny
I use PIL to write some text to a picture.The text must  be seen wery
clearly.
I write the text to different pictures but to the same position. As
pictures maybe  different, colour, in the position where I write the
text, is also different.
Is there a way how to set the font colour so that it will be seen very
clearly in the picture?
For example, if the picture is bright ( for example yellow), the font
colour should be dark( e.g. black) and vice versa.
Can anyone help?
Thanks
L.

-- 
http://mail.python.org/mailman/listinfo/python-list


Picture resolution and PIL

2007-04-06 Thread Johny
Is it possible to find out a picture resolution by using  PIL package?
Thanks for help
L.

-- 
http://mail.python.org/mailman/listinfo/python-list


Regexp problem with `('

2007-03-22 Thread Johny
I have  the following text

Goods Item  146 (174459989)  - OurWebSite

from which I need to extract
`Goods Item  146 '

Can anyone help with regexp?
Thank you for help
L.

-- 
http://mail.python.org/mailman/listinfo/python-list


Webserver balance load

2007-03-05 Thread Johny
Can anyone suggest a way how to balance load on Apache server where I
have Python scripts running?
For example I have 3 webservers( Apache servers) and I would like to
sent user's request to one of the three server depending on a load on
the server.
Thank you .
L.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: HTTP_REFERER value

2007-02-17 Thread Johny
On Feb 17, 10:21 am, Roel Schroeven <[EMAIL PROTECTED]>
wrote:
> Johny schreef:
>
> > Is HTTP_REFERER value transfered between different domains?
> > For example if I come to a website , say,www.python.org, from
> > website  www.microsoft.com
> > willwww.python.orgfinds that I came there fromwww.microsoft.com?
>
> If you get fromwww.microsoft.comtowww.python.orgby clicking a link
> on Microsoft's website, yes. If you get towww.python.orgby manually
> typing in the URL or by using a bookmark, no.
>
> --
> If I have been able to see further, it was only because I stood
> on the shoulders of giants.  -- Isaac Newton
>
> Roel Schroeven

Thank you both for help.
L

-- 
http://mail.python.org/mailman/listinfo/python-list


HTTP_REFERER value

2007-02-17 Thread Johny
Is HTTP_REFERER value transfered between different domains?
For example if I come to a website , say, www.python.org, from
website  www.microsoft.com
will www.python.org finds that I came there from www.microsoft.com?
Thank you for help
L.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Regex - where do I make a mistake?

2007-02-16 Thread Johny
On Feb 16, 2:14 pm, Peter Otten <[EMAIL PROTECTED]> wrote:
> Johny wrote:
> > I have
> > string="""55.
> > 128
> > 170
> > """
>
> > where I need to replace
> > 55.
> > 170
>
> > by space.
> > So I tried
>
> > #
> > import re
> > string="""55. > class="test123">128170
> > """
> > Newstring=re.sub(r'.*'," ",string)
> > ###
>
> > But it does NOT work.
> > Can anyone explain why?
>
> "(?!123)" is a negative "lookahead assertion", i. e. it ensures that "test"
> is not followed by "123", but /doesn't/ consume any characters. For your
> regex to match "test" must be /immediately/ followed by a '"'.
>
> Regular expressions are too lowlevel to use on HTML directly. Go with
> BeautifulSoup instead of trying to fix the above.
>
> Peter- Hide quoted text -
>
> - Show quoted text -

Yes, I know "(?!123)" is a negative "lookahead assertion",
but do not know excatly why it does not work.I thought that

(?!...)
Matches if ... doesn't match next.  For example, Isaac (?!Asimov) will
match 'Isaac ' only if it's not followed by 'Asimov'.

-- 
http://mail.python.org/mailman/listinfo/python-list


Regex - where do I make a mistake?

2007-02-16 Thread Johny
I have
string="""55.
128
170
"""

where I need to replace
55.
170

by space.
So I tried

#
import re
string="""55.128170
"""
Newstring=re.sub(r'.*'," ",string)
###

But it does NOT work.
Can anyone explain why?
Thank you
L.

-- 
http://mail.python.org/mailman/listinfo/python-list


Urllib2 and timeouts

2007-02-14 Thread Johny
In my script I started using urllib2 to connect to a list of
servers.It works well but only  until  a server from the list is not
available.Then if it is down , there is a timeout and my script ends
with the error.
So, if I have a list of 10 servers, and the second from the list is
not available , no others are used.
Is there a way how to solve that problem, so that servers after  the
server that is  not available will be used  too?
Thanks for help
L.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to find all the same words in a text?

2007-02-10 Thread Johny
On Feb 10, 2:42 pm, Marco Giusti <[EMAIL PROTECTED]> wrote:
> On Sat, Feb 10, 2007 at 05:29:23AM -0800, Johny wrote:
> >I need to find all the same words in a text .
> >What would be the best idea  to do that?
> >I used string.find but it does not work properly for the words.
> >Let suppose I want to find a number 324 in the  text
>
> >'45  324 45324'
>
> >there is only one occurrence  of 324 word but string.find()   finds 2
> >occurrences  ( in 45324 too)
>
> >>> '45  324 45324'.split().count('324')
> 1
> >>>
>
> ciao
Marco,
Thank you for your help.
It works perfectly but I forgot to say that I also need to find the
possition of each word's occurrence.Is it possible that
Thanks.
L

-- 
http://mail.python.org/mailman/listinfo/python-list


How to find all the same words in a text?

2007-02-10 Thread Johny
I need to find all the same words in a text .
What would be the best idea  to do that?
I used string.find but it does not work properly for the words.
Let suppose I want to find a number 324 in the  text

'45  324 45324'

there is only one occurrence  of 324 word but string.find()   finds 2
occurrences  ( in 45324 too)

Must I use regex?
Thanks for help
L.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Strings in Python

2007-02-09 Thread Johny
Thanks ALL for help and ideas
L

-- 
http://mail.python.org/mailman/listinfo/python-list


Strings in Python

2007-02-08 Thread Johny
Playing a little more with strings, I found out that string.find
function provides the position of
the first occurance of the substring in the string.
Is there a way how to find out all substring's position ?
To explain more,
let's suppose

mystring='12341'
import string

>>> string.find(mystring ,'1')
0

But I need to find the  possition the other '1' in mystring too.
Is it possible?
Or must I use regex?
Thanks for help
L

-- 
http://mail.python.org/mailman/listinfo/python-list


string.find for case insensitive search

2007-02-07 Thread Johny
Is there a good way how to use string.find function to find a
substring if I need to you case insensitive substring?
Thanks for reply
LL

-- 
http://mail.python.org/mailman/listinfo/python-list


Repr or Str ?

2007-02-06 Thread Johny
Where and when is good/nescessary to use `repr`  instead of `str` ?
Can you please explain the differences
Thanks
LL

-- 
http://mail.python.org/mailman/listinfo/python-list


IP address of webserver

2007-01-27 Thread Johny
How can I find server's IP address?
>From console I can use ping, for example:

C:\RobotP\cgi-bin>ping www.google.com

Pinging www.google.com [209.85.129.147] with 32 bytes of data:

Reply from 209.85.129.147: bytes=32 time=30ms TTL=244
Reply from 209.85.129.147: bytes=32 time=30ms TTL=244
..
..
So I know  that www.google.com has 209.85.129.147  IP address.
But how can I find it directly from Python script?
Thanks for help
J.

-- 
http://mail.python.org/mailman/listinfo/python-list


Regex for URL extracting

2007-01-24 Thread Johny
Does anyone know about a good regular expression  for URL extracting?

J.

-- 
http://mail.python.org/mailman/listinfo/python-list