Operating system error 123 The filename, directory name, or volume label syntax is incorrect

Dear Friends,

i am new in this forum and i hope that i will get the solution to this error.

actually, i want to import bulk data into the server table but literally failing below of the error mentioned below, i have tried both the ways using .txt and .csv files but still fails.

Cannot bulk load because the file "‪C:\Users\Shaik\Desktop\Import.csv" could not be opened. Operating system error code 123(The filename, directory name, or volume label syntax is incorrect.).

BULK INSERT PhoneBook
FROM '‪C:\Users\Shaik\Desktop\Import.csv'
WITH

(
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n'
)
GO

i dont know how to solve it, Please have a look a try to give me your responses.

Thanks

Introduction

This article will show how to solve an error message appear as OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: ”. The error itself appear after adding an application module to the project using a Django-based framework. After adding it to a file with the name of ‘settings.py’ exist in the root folder of the project and then run it, the error appear later on. The following is the part where the application module name exist in the ‘settings.py’ for a comparison.

The original configuration of the ‘settings.py’ file :

# Application definition INSTALLED_APPS = [     'django.contrib.admin',     'django.contrib.auth',     'django.contrib.contenttypes',     'django.contrib.sessions',     'django.contrib.messages',     'django.contrib.staticfiles', ]

After editing the original configuration of the ‘settings.py’ by adding an application module with the name of ‘myapp’ :

# Application definition INSTALLED_APPS = [     'django.contrib.admin',     'django.contrib.auth',     'django.contrib.contenttypes',     'django.contrib.sessions',     'django.contrib.messages',     'django.contrib.staticfiles',     'myapp' ]

Furthermore, the following is the actual process for creating a new project and a new application :

  1. Run django-admin startproject ‘project_name’. As in this example, the following is the execution of the command pattern :

    (env) C:\programming\python\django>django-admin startproject myproject (env) C:\programming\python\django>
  2. Next step, run the django-admin startapp ‘app_name’. As for the example, the following is the execution of the command pattern :

    (env) C:\programming\python\django>django-admin startapp myapp (env) C:\programming\python\django>
  3. Apparently, the following is the actual tree directory structure :

    Folder PATH listing for volume Windows Volume serial number is E003-3593 Folder PATH listing for volume Windows Volume serial number is E003-3593 C:programming\python\django | +---env +---myapp +---myproject

    For further reference about the command usage of ‘tree’ to print the content of a directory, just read the article ‘How to save the directory structure of a path in Microsoft Windows to a file’ in this link.

Solution

The actual solution for the above error is simple. The above error message appear when running a virtual server using the following command path for running the Django project :

Test (env) C:\programming\python\django\myproject>python manage.py runserver Watching for file changes with StatReloader Exception in thread django-main-thread: Traceback (most recent call last): File "C:\Python38\lib\threading.py", line 932, in _bootstrap_inner ... ModuleNotFoundError: No module named 'myapp' Traceback (most recent call last): File "manage.py", line 22, in main() File "manage.py", line 18, in main execute_from_command_line(sys.argv) ... OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: '' (env) C:\programming\python\django\myproject>

So, the application module with the name ‘myapp’ cannot be found as in the output above. Although, the definition to add ‘myapp’ is exist in the ‘settings.py’ file as part of the project configuration setting file. Actually, the solution is very simple. The problem exist in the path of the application module with the name ‘myapp’. Just move the ‘myapp’ folder into the ‘myproject’ folder so that the directory structure will be in the following structure :

Folder PATH listing for volume Windows Volume serial number is E003-3593 Folder PATH listing for volume Windows Volume serial number is E003-3593 C:programming\python\django | +---env +---myproject | |---myapp

How do I fix error code 123?

How do I fix the printer error code 123?.
Restore the computer manually. Restart your computer and log into Windows as an Administrator. ... .
Disable startup processes. ... .
Clean up your disk. ... .
Scan the computer with Microsoft Security Essentials. ... .
Check for system disk corruption with the CHKDSK utility..