Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
Improve this question
I'm looking for an alternative to python's ftplib, for speed purposes. When performing FTP uploads, python's ftplib.FTP.storbinary does sequential read to memory then send to server, in chunks of a specified block size, until the file is uploaded. Because of this, it's simply not very fast. Ideally a thread would constantly be reading at least one block size ahead, and another thread would always be sending the block already in memory. The speed of python itself could also be a factor, but in any case Ubuntu's native FTP client (command line) uploads ~60% faster.
I had considered using Ubuntu's native FTP client through a python subprocess, but I really want the callback feature supported by ftplib to update the upload progress of a single file every block size (calls a python function pointer after each block is sent). Additionally, it's a little tricky to call Ubuntu's native FTP client from python, since it's intended to be interactive.
So...does anyone have any suggestions for an FTP client in python that supports a callback feature and is faster than python's ftplib? I'm open to compiled C/C++ libraries that are already setup with a python wrapper.
Edit: I just came across pycurl, which may fit the bill. Somehow didn't see that one before. Still happy to hear other suggestions!
I think pycURL would be one of your best options. I have found another question on this site from a while back that agrees to this. The question is not exactly the same as yours, but maybe it will help you out.
Here is the link to that question: Python Libraries for FTP Upload/Download?
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
If not, is there any function to flush the butter of fileIO?
Certainly this is possible from a technical point of view:
You need some sort of volume server for this. Typically used are either nfs or samba for such task, though many other options exist. You can use these to "export" the volume for usage by other systems. This also means, that you need to attach that "portable disk" (probably some sort of USB volume) to some local system where such software is installed and executed on.
However there is one issue here: the remote, importing (so mounting) system must be able to reach the exporting system on the network. So the exporting system must be visible on the network or even internet. This certainly is possible, but might require a little more effort if you do not have a static, routeable ip address for the exporting system. In such cases this is not really a good idea, since the reliability of the whole setup is questionable.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
I'm looking for a Python library that will allow me to record, manipulate, and merge audio files. Most of the ones I've seen don't support Windows and/or are outdated. Does anyone have any suggestions for libraries or how these functions could be implemented with the standard python library?
Recording and Manipulating are generally different problems. For both of these, I stick with .wav file formats since (at least in their simpler forms) they are basically just the raw data with a minimal header and are easy to work with.
Recording: I use pyaudio, which provides bindings to the portaudio library.
Manipulation: For simple things I use audioop which is included in the basics Python installation, and for more complex things I go straight to scipy (which can read in many .wav files with scipy.io.wavfile.read) and then manipulate the data like any other time-series data. scipy is powerful and fast, but doesn't offer many audio specific tools nor does it present things in an audio specific terminology.
There are other things out there, though less well established, such as Snack, Audiere, and AudioLazy, are tools I've heard of bet never used, and I don't know which are still available, or their level of development, etc.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I want to write a Python script/program which kills a program specified by the user.
Does anyone have an idea how to do that?
I'm pretty new to Python and I just want a little script.
The simplest approach most likely is to write a thin wrapper around the tasklist command. It does the following:
"Displays a list of applications and services with their Process ID (PID) for all tasks running on either a local or a remote computer."
So you would spawn a process (using Python's subprocess module) to run tasklist, fetch its output (stdout), and parse the output using standard Python methods. You would look for a certain program name in the output and then identify the corresponding process ID. You can then terminate the process using os.kill().
Since you are a "noob in Python", you will probably spend quite some time learning the appropriate Python string manipulation/parsing functions, and also spend some time reading documentation about the subprocess module. All of this actually is quite simple, but you will have to invest some time -- believe me, this is worth the effort, you will learn a lot!
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
I'm writing end-to-end tests for my tool, which is written in Python. The tool reads a file as input. I want to test its exit code, and its output.
This is a fairly common idiom, and I've seen it done in several ways. In the PHP project, each test is a file, and has lines like: INPUT:, EXPECTED:, EXPECTED_REGEX:, etc. In my own phc project, each file is a normal source file, but with a comment added to the top, which includes keywords like EXPECTED. I think I had copied that off gcc which uses a much more complex tool written in tcl.
Are there frameworks, libraries, etc, that do this in Python? It should:
read the source file
parse special keywords (or similar) corresponding to expected output, exit code, words/regexes it expects to find or not find,
check that the output is correct.
While it doesn't seem hard in theory, I recall lots of edge-cases (esp involving escaping) when implementing this before, and would rather not reinvent the wheel.
The robot framework might be helpful. It is a keyword driven functional testing tool implemented in python and can be extended with pythion or java.
see: http://robotframework.googlecode.com/svn/tags/robotframework-2.5.4/doc/userguide/RobotFrameworkUserGuide.html
There are a number of built in libraries that you might be able to apply to solve your problem, including a OperatingSystem library for working with files etc. and a Strings library for working with strings:
http://robotframework.googlecode.com/svn/tags/robotframework-2.5.4/doc/userguide/RobotFrameworkUserGuide.html#standard-libraries
There is also a http://pythonpaste.org/scripttest/ library by Ian Bicking.
Since the implementation of file io is system dependent, why not mock out the file reading and writing using StringIO:
http://docs.python.org/library/stringio.html
and then test the bulk of the logic (reading from a file, doing some stuff, writing to a file) in python?
Then, perhaps you could have one end to end test for basic sanity by having a separate python file call out to the script using the commands module or something similar where you are calling out to it as another process:
http://docs.python.org/library/commands.html
Using that you could get both the output, and the status.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I'm writting a small python script notify me when certain condition met. I used smtplib which does the emailing for me, but I also want the script to call my cell phone as well.
I can't find a free library for phone callings. Does anyone know any?
Make the calls using Skype, and use the Skype4Py API.
If you want other suggestions, please specify how you want to make the call (modem? Some software bridge? What?).
Also, might I suggest that you send an SMS instead of placing a call? You can do that via Skype too, btw.
Twilio can make calls through their API. Pay as you go. Worked well for wakeup calls for me.
I've used Skype4Py very successfully. Keep in mind though it does require Skype to be installed and costs the standard rate for SkypeOut.