-1

I tried running this command but it keeps showing the following error.

C:\Users\NIHARIKA CHATURVEDI\Anaconda3\Lib\site-packages> pyuic5 -x homepage.ui -o homepage.py
'C:/Users/NIHARIKA' is not recognized as an internal or external command, operable program or batch file.

I think there's issue in my username.

I have also tried quoting arguments:

pyuic5 -x "homepage.ui" -o "me.py"
pyuic5 -x "C:\Users\NIHARIKA CHATURVEDI\Anaconda3\Lib\site-packages\homepage.ui" -o "C:\Users\NIHARIKA CHATURVEDI\Anaconda3\Lib\site-packages\me.py"
pyuic5 -x "%userprofile%\Anaconda3\Lib\site-packages\homepage.ui" -o "%userprofile%\Anaconda3\Lib\site-packages\me.py"
pyuic5 -x "%cd%\homepage.ui" -o "%cd%\me.py"

But none of these worked.

double-beep
  • 5,031
  • 17
  • 33
  • 41
manjy
  • 109
  • 1
  • 2
  • 12
  • 1
    Have you tried with `%userprofile%`? Type `pyuic5 -x "%userprofile%\Anaconda3\Lib\site-packages\homepage.ui" -o %userprofile%\Anaconda3\Lib\site-packages\me.py"`. Or even with `%cd%`? Type `pyuic5 -x "%cd%\homepage.ui" -o "%cd%\me.py"`. What are you getting now? – double-beep Dec 25 '18 at 09:16
  • 2
    Or try even quoting the files: `pyuic5 -x "homepage.ui" -o "me.py"`. Which of these ways worked for you? Also, please see [why I downvoted your question](http://idownvotedbecau.se/imageofcode). – double-beep Dec 25 '18 at 09:19
  • The last paragraph on last help page output on running in a command prompt window `cmd /?` explains that a file name with a space or one of these characters ``&()[]{}^=;!'+,`~`` must be enclosed in `"` or the space character is interpreted as argument string separator. Please click on gray displayed __delete__ after using the command whatever it is (I can't read images, just text) with enclosing all file names in double quotes. – Mofi Dec 25 '18 at 09:28
  • @double-beep I improved format of my question, can you remove the down vote or something more needs to be done? – manjy Jan 07 '19 at 13:30
  • Are you getting the same error? [Edit] your question to clarify which is the error you are getting. Also, suggest to try `"C:\full\path\there\pyuic5.exe" -x "C:\Users\NIHARIKA CHATURVEDI\Anaconda3\Lib\site-packages\homepage.ui" -o "C:\Users\NIHARIKA CHATURVEDI\Anaconda3\Lib\site-packages\me.py"`. Is it working? – double-beep Jan 07 '19 at 16:30

2 Answers2

1

You should enclose filenames in double-quotes:

The completion code deals correctly with file names that contain spaces or other special characters by placing quotes around the matching path. Also, if you back up, then invoke completion from within a line, the text to the right of the cursor at the point completion was invoked is discarded.

The special characters that require quotes are: <space>

`&()[]{}^=;!'+,`~`

From cmd /? help page (last page)

So, there are many posssible solutions:

1. Just double-quote filenames:

pyuic5 -x "homepage.ui" -o "me.py"

2. Include double-quoted full path:

pyuic5 -x "C:\Users\NIHARIKA CHATURVEDI\Anaconda3\Lib\site-packages\homepage.ui" -o "C:\Users\NIHARIKA CHATURVEDI\Anaconda3\Lib\site-packages\me.py"

2.1 Using %userprofile% environment variable:

pyuic5 -x "%userprofile%\Anaconda3\Lib\site-packages\homepage.ui" -o "%userprofile%\Anaconda3\Lib\site-packages\me.py"

2.2 Using %cd% environment variable to make it even shorter:

pyuic5 -x "%cd%\homepage.ui" -o "%cd%\me.py"

Some clarifications:

%userprofile% environment variable holds value C:\Users\%username% where %username% environment variable holds the name of the user currently logged in. Both variable values are unquoted.

%cd% holds the value of the path of the current working directory.

The error you were getting was because system understood homepage.ui and me.py as C:\Users\NIHARIKA CHATURVEDI\Anaconda3\Lib\site-packages\homepage.ui and C:\Users\NIHARIKA CHATURVEDI\Anaconda3\Lib\site-packages\me.py respectively.

Suggest to read last page of help in cmd /? and this great answer by @dbenham:

How does the Windows Command Interpreter (CMD.EXE) parse scripts?

Community
  • 1
  • 1
double-beep
  • 5,031
  • 17
  • 33
  • 41
0

use "User name" I am installing mongodb server and faced the same error.

enter image description here

So just put double quote before and after user name.

Example : C:\Users\"Prabhat Suman"\mongodb\bin enter image description here

Michael Nelles
  • 5,426
  • 8
  • 41
  • 57