Magmi import error - magmi

trying out the Magmi importer. Saved a file under the /var/import directory, which is found by Magmi and displayed in the dropdown of the file to import section, but when I run the import process I get the error message "NO FILE".

Check the file permission using for the file using linux console command chmod or cPanel
[magmi_root]/magmi/conf/Magmi_CSVDataSource.conf
If the file is not writable, Magmi cannot save the settings. Change the appropriate file permissions save the Magmi profile again, you are done!

Make sure you hit Save Profile after selecting the CSV file in the dropdown.
As a final check, open the magmi/conf/Magmi_CSVDataSource.conf file and see if the filename variable is set to the correct CSV location:
[Magmi_CSVDataSource]
CSV:importmode = "local"
CSV:basedir = "var/import"
CSV:filename = "/absolute/server/path/to/your/import.csv"
CSV:remoteurl =
CSV:remoteuser =
CSV:remotepass =
CSV:separator = ","
CSV:enclosure = ":DQUOTE:"
CSV:headerline =

Did you check if "Filesystem Path to magento directory" is correct? The default value is: "../.." This is correct when Magmi is installed in: [magento_root]/magmi/web/magmi.php I think you can also enter the absolute path to you Magento directory.

Related

Issues with os.listdir when script is an executable

I have created a script that takes a file from one folder and produces another file in another folder. This is a project to convert one format into another to be used by people who dont have strong background in informatics so I have created a folder with the script plus the input folder and the output folder. The user just need to put the input file in the input folder and take the results from the output folder.
The script works fine if I run this python script when running with visual code as well as If I run the script using the terminal ( python CSVtoVCFv3.py )
but when I convert my script in an executable with pyinstaller I found the next error.
File "CSVtoVCFv3.py", line 99, in <module>
FileNotFoundError: [Errno 2] No such file or directory: '/Users/manoldominguez/input/'
[99327] Failed to execute script CSVtoVCFv3
The code used in line 99 is:
97 actual_path = os.getcwd()
98 folder_input = '/input/'
99 input_file_name = os.listdir(actual_path+folder_input)
100 input_file_name= ''.join(input_file_name)
101 CSV_input = actual_path+folder_input+input_file_name
I have also tried this:
actual_path = (os.path.dirname(os.path.realpath('CSVtoVCFv3.py')))
So as conclusion as far as I can understand the issue is:
In these lines If I run my script I get this
'/Users/manoldominguez/Desktop/CSVtoVCF/input/'
If my script is ran with my executable I get this
'/Users/manoldominguez/input/'
os.getcwd() gives Current Working Directory - it means folder in which script was executed, but it doesn't have to be folder in which script is saved. This way you can run code in different folder and it works with files in different folder - and it can be usefull.
But if you need with files in folder where you have script then you can get this folder using
SCRIPT_PATH = os.path.dirname(os.path.realpath(__file__))
or
import sys
SCRIPT_PATH = os.path.dirname(os.path.realpath(sys.argv[0]))
not with 'CSVtoVCFv3.py'
And then you can join it
SCRIPT_PATH = os.path.dirname(os.path.realpath(sys.argv[0]))
folder_input = '/input/'
full_folder_input = os.path.join(SCRIPT_PATH, folder_input)
all_filenames = os.listdir(full_folder_input)
for input_file_name in all_filenames:
#CSV_input = os.path.join(full_folder_input, input_file_name)
CSV_input = os.path.join(SCRIPT_PATH, folder_input, input_file_name)
I only don't like your
input_file_name = os.listdir(actual_path+folder_input)
input_file_name= ''.join(input_file_name)
because listdir() may gives more files and then your join may create incorrect path. Better get input_file_name[0] for single file or use for-loop to work with all files in folder.
BTW: Maybe you should use sys.argv to get path as parameter and then everyone may decide where to put file.

Heroku problem when trying to download .CSV file into local download folder

I have a requirement to be able to download attendee details from an SQL table into a CSV file.
The code below works perfectly for my local deployment, creating a .csv file in the /app/static directory which the Return statement downloads to my desktop.
When uploaded to Heroku the same code fails on the final line (Return) stating:
'FileNotFoundError: [Errno 2] No such file or directory: '/app/app/static/users1001.csv'
This suggests it has created the file on the server but is looking in the wrong place (an extra '/app'). However, no file has been created anywhere (I've checked using Heroku Run Bash). The code:
name = 'attendees' + str(name) # name = 1001 in this example
f = open('%s.csv' % name, 'w')
out = csv.writer(f)
out.writerow([ 'Date','Activity No','Activity', 'User No', 'User Name',\
'Cost','Received','Update Time'\
])
for item in Attendees.query.filter_by(club=current_user.club)\
.order_by(Attendees.activitydate.desc(),Attendees.activityname):
out.writerow([item.activitydate, item.activitynumber,\
item.activityname,item.usernum,\
item.username,item.cost,item.received,item.update_time])
path='static/'+name+'.csv' # this was necessary for the local deployment
# csv writer send to 'static' by default but
# send_file needs it stated explicitly
f.close()
return send_file(path, as_attachment=True)
My question therefore is does anyone know where this file is stored in Heroku such that I can complete the download?
One further wrinkle that I can't explain. If I run this for club 1002 (not 1001), the code works and downloads a file attendees1002.csv (this is a file I created locally and was uploaded to Heroku by GIT). You will see below that this file is actually in /app/static/temp which is really confusing.
From Heroku Run Bash:
~/app/static $ dir
1002.csv clubmanager2020.jpg code39_barcode.svg eds.jpg loading.gif ratings.csv
bwt.jpg clubmanager2020.png dump.csv eetc.jpg out.csv temp
~/app/static $ cd temp
~/app/static/temp $ dir
attendees1002.csv out.csv ratings.csv users1002.csv
Any help greatly appreciated
I've found some documentation to fix this problem. Heroku does not allow creation of files on the system except in the /tmp directory off the root directory. The problem was fixed by changing:
name = 'attendees' + str(name)
to
../../tmp/name = 'attendees' + str(name)
and
path='static/'+name+'.csv'
to
path=name+'.csv'

How to set path to file in Laravel?

I have located file in root directory of Laravel.
From controller I try to get this file like as:
$shipments = json_decode(file_get_contents("Statistics.json"), true);
But I get error.
What correct path to specify for getting file?
https://laravel.com/docs/5.0/helpers#paths
I guess you need base_path
file_get_contents(base_path().'/Statistics.json');

JFolder::create: Could not create directory - Joomla

I end up with below error when I try to install a component,module or plugin.
JFolder::create: Could not create directory
What could be the issue?
Change the below variable to in your configuration file(configuration.php) as shown.
public $log_path = '/logs';
public $tmp_path = '/tmp';
Also make sure that these folder has the folder permission 755.
Read more
Now I found two solutions for resolving this issue,and both of them has been worked very well:
Solution One:
First find the exact absolute path to your tmp folder by using this trick:
Create a PHP file in your website root,for example path.php
Place this snippet of code in the file and hit the save button
<?php
$path = getcwd();
echo "Your Absolute Path is: ";
echo $path;
?>
Navigate to yourdomain.com/path.php in your browser
From now on:
Login to your Joomla Administartor panel.
Go to Global Configuration
Click on the "Server" tab
Change the path to the "Absolute Path(you've just found)"/tmp
Insert this line of code in your .htaccess file: php_value open_basedir NULL
This solution has been worked very well for me,and it's doesn't deal with any Joomla's core file hacking.
Solution Two:
Login to your Joomla Administartor panel.
Go to Global Configuration
Click no the "Server" tab
Change the path from /public_html/tmp to just tmp
Login to control Panel(CPanel),(Or you can use a FTP account for this purpose)
Open File Manager (if you are using FTP,this step must be skipped)
Open Folder "libraries"
Open Folder "joomla"
Open Folder "filesystem"
Right Click on "folder.php" and click Edit.
Look for the line, (search = obd):
$obd = ini_get('open_basedir'); Comment out that line with // at the beginning so it becomes://$obd = ini_get('open_basedir');
Save and Close.
You can change the owner of Joomla folders to your apache server user.
You can find the apache server user with the following command:
ps aux | grep -v root | grep apache | cut -d\ -f1 | sort | uniq
Source: https://serverfault.com/questions/125865/finding-out-what-user-apache-is-running-as
For Ubuntu, it's www-data.
After you know the apache user name, then you can change the owner of all the folders and files of your Joomla installation. You can use the following command to do so:
(I suppose that your apache user is www-data)
sudo chown -R www-data:www-data /path/to/your/joomla
If you are already inside your Joomla directory, then you can run the following command:
sudo chown -R www-data:www-data .
After a lot of trouble with this error, I got a break through.
In the configuration.php file, edit the var logpath n tmppath values as below var $log_path = '/home/public_html/sitename/logs';
var $tmp_path = '/home/public_html/sitename/tmp';
This definately will work. And works for me.

What is the path of file for export csv of products

I wanna just know the path of the file where i can customize the code for export csv of products as per my need.
Create export.csv on root ..write a code to export csv the new thing is that you have to hardcode base url in the path of the product..
for example ..existing path category/product/
base url/category/product/
But remember to keep the code correct..

Resources