David,

What does it mean when someone says they cannot install a module? I can see how 
a school assignment might require using only some limited set of functionality. 
I note some installations add more than others or let you designate optional 
components to include.

Some companies may have security concerns or portability considerations. The 
finished product may be used on machines lacking what is needed or even cut off 
from the ability to get them.

But some packages are simply python code that you can simply insert into your 
own python files. If they have few external dependencies and no need to compile 
C code, can you copy them without violating rules?

I am thinking for example of a module that defines a class you may want to 
subclass. You could find the source code you would have imported and take 
relevant parts into your main code file or into any local files you import. 

I do not know if the module being discussed meets the criteria or if this would 
not  be considered honest. But it is a step to be considered. Another thread I 
have seen related to a user with no internet connection for downloading. But 
sneakernet is trivial if the only thing needed for an install might be copying 
a file or three into any valid location on the machine including the directory 
your main program is in.

And, yes, this means you do not get updates if the module changes.  

Just a thought.


Sent from AOL Mobile Mail
On Tuesday, December 4, 2018 David Rock <da...@graniteweb.com> wrote:

> On Dec 4, 2018, at 12:05, Asad <asad.hasan2...@gmail.com> wrote:
> 
> Hi All ,
> 
>          I am not allowed to import pexcept  .Therefore only option I
> have is to implement a solution using the standard libraries in python .

I’m only suggesting it because it’s an easier way to interface with expect.  If 
you aren’t allowed to install it, then we’ll stop talking about it.

>            However I am using subprocess.Popen for sftp I am unable to
> pass the password.
> 

You still are not understanding my point.  using sftp in batch mode CAN’T USE a 
password.  If you look at the manpage for sftp, batch mode prohibits it.

    -b batchfile
            Batch mode reads a series of commands from an input batchfile 
instead of stdin.
            Since it lacks user interaction it should be used in conjunction 
with non-inter‐
            active authentication.  <<—————

“non-interactive authentication” means you must use an ssh key to authenticate 
instead of a password.  In other words, trying to figure out how to send a 
login to the subprocess is not the issue; even if you can, it won’t work 
because sftp *in batch mode* will not accept it.  If you _can’t_ set up an ssh 
key for this access, then you MUST stop trying to use batch mode, because it 
will never work.

>  Here I am unable to proceed , I am sure someone would have cracked this
> problem earlier if they can share the code

There is no code for this because it is not possible to do within the 
constraints you have proposed up to this point.

1. Can you set up ssh key passwordless authentication?
  if yes, then do it and what you have now will start working
  if no, then you can’t use sftp the way you are currently trying (the -b 
“batch mode”) and find a different solution (expect, here docs, etc).


— 
David Rock
da...@graniteweb.com




_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to