No csv files found errror in magmi - magento

we are using magmi_full_0.7.19a
we placed a csv file under var/import directory.
but still we are getting mesage as : No csv files found in magmi page
Relative paths are relative to magento base directory , absolute paths will be used as is

Put Your csv files under the magmi/var/import
but generally magmi take path in root/var/import so make sure that you have to create a imoprt folder in var

Related

How can I avoid "Zip end of central directory signature not found (Zip::Error)" with rubyzip?

I'm reading a lot of zip file with rubyzip.
However this error message is always showing in only specific file even it is zip file.
/app/vendor/bundle/ruby/2.3.0/gems/rubyzip-1.2.1/lib/zip/central_directory.rb:143:in `get_e_o_c_d': Zip end of central directory signature not found (Zip::Error)
I guess this error occures in rubyzip.
How can I manage this error?
Here is my code.
url = 'http://example.zip'
zipfilename = open(url)
Zip::File.open(zipfilename, :allow_redirections => :all) do |zip_file|
entry = zip_file.glob("*ixbrl.htm").first
stream = entry.get_input_stream.read
puts stream
end
Thank you!
I faced this error when I try to extract data from a uploaded .xlsx file in my application. On my context, the .xlsx file was corrupted, so my solution was save the content (I usually handle the buffer file after the upload) as a csv file (in my application I dont need to worry about the file extension), fixing the content by force it to encode as utf-8, and extract it's data after it. here is a example of the code, I'm using roo-xls gem to handle .xls files and roo gem to handle .csv and .xlsx files.
I ran into the same error. Also only reproducible on Heroku. The error was fixed after I added an unzip buildpack (second, after Ruby).
https://github.com/davidlibrera/heroku-buildpack-unzip
If you're using a google docs xlsx file try checking if the access of the sheet link is public.

google-drive-ruby: upload file to a folder duplicates the file in the folder and root path

I have writen a Ruby script to lookup for documents with a given date and upload them to Google Drive by using the google-drive-ruby gem. I have a folder inside of the gdrive root path where I want to place the files, and I access it using collection_by_title and then uploading the file by using the .add method.
The problem is that the files are being uploaded each one two times, one to the folder I want and another one to the root path of my GDrive. Any thoughts?
This is the method where the file gets uploaded:
def upload_document(file, folder_code)
folder = #session.collection_by_title("#{folder_code}")
path = "#{#basedir}/#{folder_code}/#{file}"
folder.add(#session.upload_from_file(path, file, convert: false))
end
EDIT: Methods and variables translated to english.
Each time the method upload_document is triggered, one copy of the file gets uploaded to the folder and another copy gets uploaded to the root path of gdrive.
Example: Method upload_document gets called providing the file (454327.pdf) and the code of the folder where it has to be uploaded in gdrive ("1"). I build the folder object by using collection_by_title, I build the path where the file is located in my local network, and finally the file gets uploaded using upload_from_file. At this point, two copies of the file had been uploaded, one to the root path of gdrive (which I don't want) and another one to the right folder in gdrive.
I received an answer from the gem creator explaining what is happening and my script is finally working as I expected.
https://github.com/gimite/google-drive-ruby/issues/260
The thing is that the file is firstly uploaded to the root by default and then .add just moves the file to the selected collection, so the file needs to be removed from root after the move operation is completed.
#session.root_collection.remove(file)

Laravel location of created files

I'm attempting to modify a text file stored on the server using Larvel's File::put(filelocation,filecontents)
but I can't figure out what location this is relative to on the server. If I have a file "somestuff.json" within my LaravelApp/public folder, what location string do I use for a parameter to File::put() ?
File name for File::methods() is not relative you have to give the full file path:
File::put('/var/www/LaravelApp/public/somestuff.json', $filecontents);
But Laravel has some helpers to help you with this:
File::put(public_path().'/somestuff.json', $filecontents);
Also:
base_path(); // the base of your application LaravelApp/
app_path(); // Your LaravelApp/app
They are all in the file vendor/laravel/framework/src/Illuminate/Support/helpers.php.

Get full path to file from within migration

I need to insert the contents of a file into the database during a migration (Rails 3.2.13). What's the proper way to reference a file that is elsewhere in the project?
db/migrate/the_migration.rb
class ...
content = File.read("../../app/views/layours/application.html.erb")
end
The relative path doesn't seem to work - I get:
No such file or directory - ../../app/views/layouts/application.html.erb
How can I map this path to an absolute path?
You can try the code below:
class ...
path = File.expand_path('../../app/views/layouts/application.html.erb', __FILE__)
content = File.read(path)
end
assuming you are using rake to apply an active record migration. The file path will be relative to where you started rake which I'm sure will be the projects root.
The file path would be:
content = File.read("app/views/layouts/application.html.erb")

Magento 1.7.0.2 Image does not exist

i am import bulk images to the mogento i had the error "Image does not exist" i am trying the fallowing
1)products folder placed at /media/catalog/product/ and also create a folder import at media media/import
2)csv file is convert into UTF-8 format
3)image name in csv file is like this /media/catalog/product/products/91803_1_201081211141.jpg
quid me for better solution
You should place your images in media/import i.e. media/import/photo.jpg then in your csv file you just use photo.jpg
Tested and working in Magento CE ver. 1.7.0.2
Image: /media/import/foo.png
Image name in CSV file: /foo.png
Lets say you've accidentally deleted a bunch of products but the images are still in the media/catalog/product folder. For example this may happen if you accidentally delete an attribute set because it takes the products with it. Lets say you want to export those products from your staging environment and back into production. You would go into dataflow on staging, do the export and then on production, temporarily change this file:
code/core/Mage/Catalog/Model/Convert/Adapter/Product.php
Change line 775 to
$arrayToMassAdd, Mage::getBaseDir('media') . DS . 'catalog/product/',
When you're done change it back to
$arrayToMassAdd, Mage::getBaseDir('media') . DS . 'import',
What this will do is import the product images from where they were. The csv you export from your staging environment will reference image at /l/a/etc etc... so it will work.
Don't forget the '/' at the end of catalog/product

Resources