obspy read wav file unknown format - stream

I try to reproduce the given example obspy example in order to read a wav, unfortunately even with the same code as written in the example, I raise an error:
the wav exemple file can be downloaded from here:
download 3cssan.near.8.1.RNON.wav
from obspy import read
read("3cssan.near.8.1.RNON.wav")
[...]
TypeError: Unknown format for file 3cssan.near.8.1.RNON.wav
I would be very grateful if you have any suggestion to fix this problem
I would like to use obspy because I would like to continue my analysis with using a code implemented with obspy
Best regards
Xavier

On my system, the both WAV files that are available on the Obspy's website, are possible to be read without any problems.
In your case, I would suggest to define format you want to read in the read method:
from obspy import read
read("3cssan.near.8.1.RNON.wav", format="wav")
If this still won't work, I suggest redownloading the test file as it might be corrupted.

Related

Rails 4 downloaded excel file using send_data method is giving format error

I am downloading data in excel format in my Rails 4 app using send_data method as mentioned below.
send_data collection.to_csv(col_sep: "\t"),
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
filename: 'filename.xls'
I am able to download the data, but while opening the downloaded excel file, i am getting below warning message.
The file format and extension of 'file.xls' don't match. The file could be corrupted or unsafe.
Unless you trust its source, dont open it. D want to open it anyway?
Even it is warning, it would cause confusion to customers while downloading and opening the file. Any one has any clue about, what is it about and how could it be fixed?
Any help would be greatly appreciated.
It isn't an XLS file you are creating but a CSV file, so you should change the filename to 'filename.csv'. It will still be openable in Excel.
You might also want to change the MIME type to text/csv.
The correct MIME for an Excel file can be found here.

Identify old dos system file type and decode it into text file

I have pick up an old dos system from my friend, and I need to import the data into SQL, but before importing the data, i need to decode it into a readable text file, but I failed to do so. I have try several stuff:
file command in ubuntu terminal, it said "data"
Use online trid and it said macbin(MacBinary 1)
Tried bin2hex, but couldn't unhex it
Tried some online macbin to hex, no luck as well
Tried to open in macOS, but it keep extracting files
bin2hex said, nothing here
stuffitexpander.... Doesn't recognize...
This is the file that i need to decode
https://gofile.io/?c=wdbs6A
Please let me know if you need the original program.
I think they are just some database files.
Use this site for explanations. they even have a file analyzer - showing you the data inside.
You will need to rename the files to .db extension instead of .ocm.

Get error info from cvCaptureFromAVI

I'm working with a program, which I need to document and review, but which I did not write, nor did anyone I can easily reach. One of the problems I've run into is that it is supposed to read and work with .avi files, but every time I try, it fails. The file is an avi converted from an MTS format. The computer seems to think that it is an avi file, and it runs it without incident, but I don't know why the cvCaptureFromAVI is having trouble.
The function cvCaptureFromAVI simply returns null. I can't seem to get any deeper in the code to see what in cvCaptureFromAVI is causing the error, and I haven't been able to get any error information about why it won't read the file.
I was struggling with this problem for two days!
If you've double checked all other possible causes (file is in correct directory and inside your code the path to that file is in correct format) and still cvCaptureFromAVI returns null, the problem is your computer codecs.
I suggest you installing K-Lite Codec Pack. Remember to restart your computer if you are using Windows.

how to convert xls to csv using IOS library?

I need to read xls files in my IOS app. First of all, I want to convert xls files to csv format files, then my app parse csv files, but I can't find any ios library to convert xls to csv, please help me
If you have a .xls file, you can use the open source DHlibxls library to read the file into your app. This is an ObjectiveC framework that wraps a C-based library. The library is quite mature.
ios or any objecive-framework doesn't provide any thing for accesseing Microsoft's xls :(
To convert-xls to/fro csv is itself a project in it!!!
On top of this, there are different format of xls, now xlsx files. And writing a xls and reading it back in proper way is tooooo-cumbursome task to accomplish. However we have managed to read it but it is not 100% efficient :(
I guess in near future you may want to move to xlsx file then your task will be a lot more difficult. You can check yourself, change the file name extension to .zip and unzip you will see many files, one having row numbers, another columns, third with links, fourth with contents and so on. Mapping and getting in correct form in not impossible but needs a lot of work.
There can be many other ways to do, I can suggest to use java api to do, or even save you xls to csv directory from excel, then your work will be easy.

Upload file type verification with Rails and Javascript

I'm currently working on a project where users can upload datasets in CSV format.
Is there a good way with Ruby other than checking file extension to determine if they're really uploading a CSV and not some executable or some other file type?
You can't do this in javascript that's for sure. If you're in a UNIX environment, you can check the documentation about this.
I don't think there is any SURE way of checking this. Usually checking the file extension is fine. Plus you said you're getting CSVs, couldn't you try to parse them? If it fails, then either the document is not at the right format or it's not a csv.
Anyways, make sure that you're storing your files in a directory that has no execute access right.

Resources