Re: [PythonCE] PyCrypto binaries -- nearly there..

2007-08-05 Thread Marc Horst
Hi Alexandre,

Thanks for your help! I made the change to Agent.py and my PDA is now 
able to connect to the notebook, but then it crashes (see the logging 
below):

 >>> execfile('\\Flash 
Disk\\Programmabestanden\\Python25\\Lib\\demo_pda.py')
*** Unable to open host keys file
*** WARNING: Unknown host key!
*** Here we go!

Line-buffered terminal emulation. Press F6 or ^Z to send EOF.  Linux 
marc-laptop 2.6.15-28-386 #1 PREEMPT Wed Jul 18 22:50:32 UTC 2007 i686 
GNU/Linux  The programs included with the Ubuntu system are free 
software; the exact distribution terms for each program are described in 
the individual files in /usr/share/doc/*/copyright.  Ubuntu comes with 
ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. Last 
login: Sun Aug  5 20:53:55 2007 from 192.168.0.9
 *** Caught exception: : [Errno 0] Error
Traceback (most recent call last):
  File "\Flash Disk\Programmabestanden\Python25\Lib\demo_pda.py", line 
179, in 
interactive.interactive_shell(chan)
  File "\Flash Disk\Programmabestanden\Python25\lib\interactive.py", 
line 36, in interactive_shell
windows_shell(chan)
  File "\Flash Disk\Programmabestanden\Python25\lib\interactive.py", 
line 91, in windows_shell
d = sys.stdin.read(1)
IOError: [Errno 0] Error
 *** EOF ***  Traceback (most recent call last):
  File "\Flash Disk\Programmabestanden\Python25\Lib\demo_pda.py", line 
190, in 
sys.exit(1)
  File "\Flash Disk\Programmabestanden\Python25\Lib\demo_pda.py", line 
41, in dummy_exit
raise ExitError()
ExitError
 >>>


I'm a newbee in Python and with ssh, so I can't make any conclusions 
from this message; hopefully you can ;-)

Furthermore I tried the program you sent me as a replacement for demo.py 
(I just changed the servername, username and password; that was all I 
had to change, right?), but this didn't work (I tried it on my PC). When 
trying it in IDLE, it gives the following message:

Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit 
(Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
 >>> from paramiko import SSHClient, AutoAddPolicy
 >>>
 >>> def main():
... client = SSHClient()
... client.set_missing_host_key_policy(AutoAddPolicy())
... client.connect('nyservername', username='myusername', 
password='mypassword')
... stdin, stdout, stderr = client.exec_command('ls -l')
... print stdout.read()
... client.close()
...
 >>> if __name__ == '__main__' : main()
...
Traceback (most recent call last):
  File "", line 1, in 
  File "", line 4, in main
  File "C:\Python25\lib\site-packages\paramiko\client.py", line 266, in 
connect
sock.connect((hostname, port))
  File "", line 1, in connect
TypeError: an integer is required
 >>>

Could you please give me some help on this one too, as I would like to 
avoid using the demo.py script ?


Thanks a lot,

Marc




[EMAIL PROTECTED] wrote:
> Marc Horst <[EMAIL PROTECTED]> a écrit :
>
>> Hi Alexandre,
>>
>> That is a good hint! I tried it and here is the result:
>>
>> Python 2.5 (release25-maint, Dec 19 2006, 23:22:00) [MSC v.1201 32 bit
>> (ARM)] on win32
> execfile('\\Flash 
> Disk\\Programmabestanden\\Python25\\Lib\\demo_pda.py')
>> *** Unable to open host keys file
>> *** WARNING: Unknown host key!
>> *** Caught exception: : No module 
>> named mmap
>> Traceback (most recent call last):
>>  File "\Flash Disk\Programmabestanden\Python25\Lib\demo_pda.py", line
>> 166, in 
>>agent_auth(t, username)
>>  File "\Flash Disk\Programmabestanden\Python25\Lib\demo_pda.py", line
>> 53, in agent_auth
>>agent = paramiko.Agent()
>>  File "\Flash Disk\Programmabestanden\Python25\lib\paramiko\agent.py",
>> line 68, in __init__
>>import win_pageant
>>  File "\Flash
>> Disk\Programmabestanden\Python25\lib\paramiko\win_pageant.py", line 27,
>> in 
>>import mmap
>> ImportError: No module named mmap
>> Traceback (most recent call last):
>>  File "\Flash Disk\Programmabestanden\Python25\Lib\demo_pda.py", line
>> 190, in 
>>sys.exit(1)
>>  File "\Flash Disk\Programmabestanden\Python25\Lib\demo_pda.py", line
>> 41, in dummy_exit
>>raise ExitError()
>> ExitError
>
>>
>>
>> I looked on my __PC__ (as I guessed that if it worked on my PC, mmap
>> should be called here too) for a file named mmap and for files with as
>> content mmap, but found only test_mmap.py. So I'm not sure what should
>> be concluded from this. Maybe that on my __PDA__ a different execution
>> path is used, in which mmap is/should be imported, which results in the
>> error message above.
>>
>> Maybe you can conclude more from this error message.
>>
>>
>> Regards,
>>
>> Marc
>>
>>
>> [EMAIL PROTECTED] wrote:
>>> I will try to run paramiko+pycrypto myself, i strongly suspect  
>>> paramiko to call sys.exit on some condition, so in the meantime you 
>>>  can try to insert this in the beginning of your code (before any  
>>> other import):
>>>
>>> import sys
>>>
>>> class ExitError(Exception):
>>>   

Re: [PythonCE] PyCrypto binaries -- nearly there..

2007-08-04 Thread alexandre . delattre
Marc Horst <[EMAIL PROTECTED]> a écrit :

> Hi Alexandre,
>
> That is a good hint! I tried it and here is the result:
>
> Python 2.5 (release25-maint, Dec 19 2006, 23:22:00) [MSC v.1201 32 bit
> (ARM)] on win32
 execfile('\\Flash Disk\\Programmabestanden\\Python25\\Lib\\demo_pda.py')
> *** Unable to open host keys file
> *** WARNING: Unknown host key!
> *** Caught exception: : No module named mmap
> Traceback (most recent call last):
>  File "\Flash Disk\Programmabestanden\Python25\Lib\demo_pda.py", line
> 166, in 
>agent_auth(t, username)
>  File "\Flash Disk\Programmabestanden\Python25\Lib\demo_pda.py", line
> 53, in agent_auth
>agent = paramiko.Agent()
>  File "\Flash Disk\Programmabestanden\Python25\lib\paramiko\agent.py",
> line 68, in __init__
>import win_pageant
>  File "\Flash
> Disk\Programmabestanden\Python25\lib\paramiko\win_pageant.py", line 27,
> in 
>import mmap
> ImportError: No module named mmap
> Traceback (most recent call last):
>  File "\Flash Disk\Programmabestanden\Python25\Lib\demo_pda.py", line
> 190, in 
>sys.exit(1)
>  File "\Flash Disk\Programmabestanden\Python25\Lib\demo_pda.py", line
> 41, in dummy_exit
>raise ExitError()
> ExitError

>
>
> I looked on my __PC__ (as I guessed that if it worked on my PC, mmap
> should be called here too) for a file named mmap and for files with as
> content mmap, but found only test_mmap.py. So I'm not sure what should
> be concluded from this. Maybe that on my __PDA__ a different execution
> path is used, in which mmap is/should be imported, which results in the
> error message above.
>
> Maybe you can conclude more from this error message.
>
>
> Regards,
>
> Marc
>
>
> [EMAIL PROTECTED] wrote:
>> I will try to run paramiko+pycrypto myself, i strongly suspect   
>> paramiko to call sys.exit on some condition, so in the meantime you  
>>  can try to insert this in the beginning of your code (before any   
>> other import):
>>
>> import sys
>>
>> class ExitError(Exception):
>>pass
>>
>> def dummy_exit(code=0):
>>raise ExitError()
>>
>> sys.exit = dummy_exit
>>
>> and see if it raises an exception instead of quitting, then you can  
>>  track-down the source to locate the condition ...
>>
>> I'm not sure if it will help, but it may be worth trying.
>>
>> Alexandre.
>>

The mmap module hasn't been ported yet to PythonCE, this afternoon I  
have tried to use paramiko on my pda and found the same error. I have  
managed to bypass it by modifying agent.py, around line 67 make the  
following modifications :

Replace :
...
elif sys.platform == 'win32':
  import win_pageant
...
by
...
elif sys.platform == 'win32':
  if os.name == 'ce':
   return
  import win_pageant
...

this deactivates the Agent features of paramiko but it makes ssh  
connection possible !

Besides, I suggest you to use the new SSHClient class that basically  
wraps the whole demo script, I had success with the following script :

from paramiko import SSHClient, AutoAddPolicy

def main():
 client = SSHClient()
 client.set_missing_host_key_policy(AutoAddPolicy())
 client.connect('the server', username='', password='')
 stdin, stdout, stderr = client.exec_command('ls -l')
 print stdout.read()
 client.close()

if __name__ == '__main__' : main()

Good continuation on your project ;)
Alexandre.

___
PythonCE mailing list
PythonCE@python.org
http://mail.python.org/mailman/listinfo/pythonce


Re: [PythonCE] PyCrypto binaries -- nearly there..

2007-08-04 Thread Marc Horst
Hi Alexandre,

That is a good hint! I tried it and here is the result:

Python 2.5 (release25-maint, Dec 19 2006, 23:22:00) [MSC v.1201 32 bit 
(ARM)] on win32
 >>> execfile('\\Flash 
Disk\\Programmabestanden\\Python25\\Lib\\demo_pda.py')
*** Unable to open host keys file
*** WARNING: Unknown host key!
*** Caught exception: : No module named mmap
Traceback (most recent call last):
  File "\Flash Disk\Programmabestanden\Python25\Lib\demo_pda.py", line 
166, in 
agent_auth(t, username)
  File "\Flash Disk\Programmabestanden\Python25\Lib\demo_pda.py", line 
53, in agent_auth
agent = paramiko.Agent()
  File "\Flash Disk\Programmabestanden\Python25\lib\paramiko\agent.py", 
line 68, in __init__
import win_pageant
  File "\Flash 
Disk\Programmabestanden\Python25\lib\paramiko\win_pageant.py", line 27, 
in 
import mmap
ImportError: No module named mmap
Traceback (most recent call last):
  File "\Flash Disk\Programmabestanden\Python25\Lib\demo_pda.py", line 
190, in 
sys.exit(1)
  File "\Flash Disk\Programmabestanden\Python25\Lib\demo_pda.py", line 
41, in dummy_exit
raise ExitError()
ExitError
 >>>


I looked on my __PC__ (as I guessed that if it worked on my PC, mmap 
should be called here too) for a file named mmap and for files with as 
content mmap, but found only test_mmap.py. So I'm not sure what should 
be concluded from this. Maybe that on my __PDA__ a different execution 
path is used, in which mmap is/should be imported, which results in the 
error message above.

Maybe you can conclude more from this error message.


Regards,

Marc


[EMAIL PROTECTED] wrote:
> I will try to run paramiko+pycrypto myself, i strongly suspect 
> paramiko to call sys.exit on some condition, so in the meantime you 
> can try to insert this in the beginning of your code (before any other 
> import):
>
> import sys
>
> class ExitError(Exception):
> pass
>
> def dummy_exit(code=0):
> raise ExitError()
>
> sys.exit = dummy_exit
>
> and see if it raises an exception instead of quitting, then you can 
> track-down the source to locate the condition ...
>
> I'm not sure if it will help, but it may be worth trying.
>
> Alexandre.
>

___
PythonCE mailing list
PythonCE@python.org
http://mail.python.org/mailman/listinfo/pythonce


[PythonCE] PyCrypto binaries -- nearly there..

2007-08-04 Thread alexandre . delattre
I will try to run paramiko+pycrypto myself, i strongly suspect  
paramiko to call sys.exit on some condition, so in the meantime you  
can try to insert this in the beginning of your code (before any other  
import):

import sys

class ExitError(Exception):
 pass

def dummy_exit(code=0):
 raise ExitError()

sys.exit = dummy_exit

and see if it raises an exception instead of quitting, then you can  
track-down the source to locate the condition ...

I'm not sure if it will help, but it may be worth trying.

Alexandre.

___
PythonCE mailing list
PythonCE@python.org
http://mail.python.org/mailman/listinfo/pythonce


Re: [PythonCE] PyCrypto binaries -- nearly there..

2007-08-04 Thread Marc Horst
Hi,

I have it almost working, but need some help... Can someone help me please?

What I did:
1) made ssh connection with my laptop work:
- install pycrypto 2.0.1
- placed paramiko directory in \python25\Lib\site-packets
- adapted demo.py so it automatically connects to my laptop
=> works fine

(I do get the following warning, followed by the ssh-prompt on the other PC:
*** Unable to open host keys file
*** WARNING: Unknown host key!
*** Here we go!

Line-buffered terminal emulation. Press F6 or ^Z to send EOF.

Linux marc-laptop 2.6.15-28-386 #1 PREEMPT Wed Jul 18 22:50:32 UTC 2007 
i686 GNU
/Linux

The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.
Last login: Sat Aug 4 14:43:06 2007 from focus
[EMAIL PROTECTED]:~/projects/robot$
)


2) tried to make it work on my PDA
- installed paramiko-1.7.1 in \Flash Disk\Program Files\Python25\Lib 
(directory is called paramiko)
- copied the Crypto directory of the zip you sent me to \Flash 
Disk\Program Files\Python25\Lib
- moved paramiko-1.7.1\demos\demo.py and 
paramiko-1.7.1\demos\interactive.py to \Flash Disk\Program 
Files\Python25\Lib (this was needed, else when running demo.py the 
imported interactive.py tries to import interactive (i.e. itself) and 
this results in an error because Python can't find it, as it is not in 
the path; moving this resolves the problem).
- when I now run demo.py (by double clicking on the file, or on the 
command line: execfile ('\\Flash Disk\\Program 
Files\\Python25\\...\\demo.py') ) , I get the same warning as on my PC 
("*** WARNING: Unknown host key!"), but then Python quits.


My questions:
- did someone try connecting (via ssh) to another PC using a PDA with 
paramiko and PyCrypt ?
- should I install something else or call the script in another way, 
change the script, , so it won't quit ?


Thank you for your time,

Marc


[EMAIL PROTECTED] wrote:
> Hi Marc,
> You're a lucky one, I have built binaries of PyCrypto for PythonCE 2.4  
> and 2.5 just a week ago ! A public download will be soon up on  
> http://www.voidspace.org.uk/ thanks to Fuzzyman that already host  
> binaries for desktop windows. Since I'm on vacation, I only have my  
> local release for 2.5 at hand. So wait for the public link or mail me  
> if you're interested in the 2.5 version.
>
> @Luke Dunstan
> Thank you for adapting the scons build environment to the wince  
> platform, it makes compiling python extension much easier and more  
> maintanable than the project oriented view of the embedded tools  
> (especially for packages that contains many C extensions and would  
> need as many projects as extensions).
> It is also easier to switch python 2.4/2.5 includes and libs for the  
> whole script. If you don't mind I will write an article on the wiki on  
> how I build extensions with scons.
>
> @Everyone
> I have also built binaries for numpy 1.0, unfortunately I havn't been  
> able to compile the random facilities but everything else seems to  
> work fine (core, fft and linalg), for now no public release but you  
> can mail me and i'll send you the files.
>
> Have a nice summer,
> Alexandre.
>
>
> ___
> PythonCE mailing list
> PythonCE@python.org
> http://mail.python.org/mailman/listinfo/pythonce
>
>
>   

-- 

  Marc Horst  -  [EMAIL PROTECTED]


___
PythonCE mailing list
PythonCE@python.org
http://mail.python.org/mailman/listinfo/pythonce