Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

grass_script.bat always fails if USERNAME contains MBCS #18019

Closed
qgib opened this issue Jan 26, 2014 · 16 comments
Closed

grass_script.bat always fails if USERNAME contains MBCS #18019

qgib opened this issue Jan 26, 2014 · 16 comments
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! GRASS

Comments

@qgib
Copy link
Contributor

qgib commented Jan 26, 2014

Author Name: Tarot Osuji (@tarot231)
Original Redmine Issue: 9425
Affected QGIS version: master
Redmine category:processing/grass
Assignee: Victor Olaya


On Windows, if USERNAME contains Multi Byte Character Set, processing with GRASS (grass_script.bat) always fails.
The reason is following bug:
#17591

Attached patch solves the problem from "Always failing" to "Available, if all value contains no MBCS". Other backends have same problem.

I think the fundamental solution is convert string value to temporal safe ascii value before create batch.
Unfortunately many tools don't consider MBCS. However if such option exists, many processing tools are able to use more widely.



Related issue(s): #20770 (relates), #24160 (relates)
Redmine related issue(s): 12657, 16250


@qgib
Copy link
Contributor Author

qgib commented Jan 26, 2014

Author Name: Tarot Osuji (@tarot231)


I'm sorry, the report explains 2 bugs.
Former is "Windows batch file which ends LF can't process MBCS". Attached patch converts the line-end of batch file: LF to CRLF.
Latter is "Many tools which invoked from batch can't operate with MBCS". It is a different matter from the former.

@qgib
Copy link
Contributor Author

qgib commented Oct 4, 2014

Author Name: Giovanni Manghi (@gioman)


  • project_id was changed from 78 to 17
  • category_id removed 59
  • version was configured as 2.4.0
  • crashes_corrupts_data was configured as 0

@qgib
Copy link
Contributor Author

qgib commented Oct 4, 2014

Author Name: Giovanni Manghi (@gioman)


  • category_id was configured as Processing/GRASS

@qgib
Copy link
Contributor Author

qgib commented Jun 1, 2015

Author Name: Giovanni Manghi (@gioman)


duplicate of #20770 ?


  • status_id was changed from Open to Feedback

@qgib
Copy link
Contributor Author

qgib commented Dec 21, 2015

Author Name: Giovanni Manghi (@gioman)


  • status_id was changed from Feedback to Open

@qgib
Copy link
Contributor Author

qgib commented Mar 5, 2016

Author Name: Médéric RIBREUX (Médéric RIBREUX)


Hello,

I am working on it (only made with GRASS7)...

I have found a way to deal with grass7_script.bat. The main problem was a MS-Windows Shell (cmd.exe) problem. MS-Windows shell can only execute scripts (.bat files) with the same encoding than the shell encoding. This encoding follows the configured language on the computer, so I had to find a way to get this encoding to build grass7_script.bat with the correct encoding.

Finally, I succeeded in launching a GRASS7 algorithm under an account with a username which has french accents.

I have made the fix tests on MS-Windows XP for the moment (the only VM with MS I have). I will try it on MS-Windows 7 next week and make a Pull-Request for this soon (so you can test it).

Stay tuned !


  • status_id was changed from Open to In Progress
  • version was changed from 2.4.0 to master

@qgib
Copy link
Contributor Author

qgib commented Mar 7, 2016

Author Name: Médéric RIBREUX (Médéric RIBREUX)


Hello,

the "PR is published":#2882...

Can you make some tests ?

@qgib
Copy link
Contributor Author

qgib commented Mar 11, 2016

Author Name: Tarot Osuji (@tarot231)


Although I tested with MBCS USERNAME, I get error.
Where do the error logs are stored ?


  • 9678 was configured as error.png

@qgib
Copy link
Contributor Author

qgib commented Mar 12, 2016

Author Name: Médéric RIBREUX (Médéric RIBREUX)


Hello and thank for your report,

logs are in the Log Messages Panel (and I need them to go further) !
You can display it by clicking on the rightest bottom button (red marked in screenshot).

I really need the logs to know where the error is. Could you paste them here (or send an attached file) ?

The pull request is working on a french version of MS Windows but I suspected that there could be other problems on different language versions of MS Windows.

I have also worked on another workaround (which should work but relies on short filenames (which is bad !)) so we have another solution if the first is not working for you.


  • 9685 was configured as qgis_log_panel.png

@qgib
Copy link
Contributor Author

qgib commented Mar 12, 2016

Author Name: Tarot Osuji (@tarot231)


Hi,

attached error log screen.
Thank you.


  • 9686 was configured as error_log160313.png

@qgib
Copy link
Contributor Author

qgib commented Mar 13, 2016

Author Name: Médéric RIBREUX (Médéric RIBREUX)


Hello,

I can see that you are using GRASS6. The fix I have made is only for GRASS7 (but I can backport it for GRASS6 once we will be sure it is really fixed).

Here is a quick test procedure:

  • You have to install QGIS 2.14 (or a "nightly build":http://qgis.org/downloads/weekly/?C=M;O=D).
  • Copy the attached version of Grass7Utils.py into C:\OSGeo4W\apps\qgis\python\plugins\processing\algs\grass7\ directory.
  • Then, start "QGIS with GRASS 7.0.3".
  • Go to Processing Menu -> Options -> Provider -> GRASS GIS 7 Commands.
  • Activate and set the GRASS7 folder (C:\OSGeo4W\apps\grass\grass-7.0.3). Set also the MSYS folder (C:\OSGeo4W\apps\msys).
  • Restart QGIS to be sure that GRASS7 is activated into Processing.
  • Try to open a GRASS7 algorithm. If the algorithm dialog box opens, it means that your problem is fixed (but you can go further and launch the algorithm).
  • If the algorithm don't open, send me the log from the log panel (on the Python and Processing tabs).

Thanks for your test...


  • 9688 was configured as Grass7Utils.py

@qgib
Copy link
Contributor Author

qgib commented Mar 13, 2016

Author Name: Tarot Osuji (@tarot231)


Hi,

thanks for teaching method to activate GRASS 7.
I didn't notice activation is required.

I tried but unfortunately error occured.

I installed QGIS 2.14 with OSGeo4W. And yesterday, I download the trunk from github.
And I replaced contents of processing folder to downloaded trunk.
And I replaced the Grass7Utils.py you uploaded.

Thank you.


  • 9689 was configured as error_log160313-2.png

@qgib
Copy link
Contributor Author

qgib commented Mar 13, 2016

Author Name: Médéric RIBREUX (Médéric RIBREUX)


Ok, I suspect this gonna be painful because I don't have the same problems than you and I can't reproduce them.

You will be my eyes for remote testing...

Can you try with the attached Grass7Utils.py and "mail me":mailto:mederic.ribreux@medspx.fr the results (to not pollute the bug tracker) ?

Thanks !


  • 9697 was configured as Grass7Utils.py

@qgib
Copy link
Contributor Author

qgib commented Apr 9, 2016

Author Name: Tarot Osuji (@tarot231)


About a month ago, I sent the following messege:

Hi,

I exchanged Grass7Utils.py and run, DEBUG log only show
tempPython=['C: .... cmdEncoding.py
and occured error with no hint.

So I added QgsMessageLog.logMessage() to find where is the problem.
Then I find runalg() fails.
next sentence,
if not os.path.exists(result['output']):
becomes True, and translated error message dialog fired.

I attached the screen. 'cp932' is Japanese subset of mbcs.

Thanks


  • 9804 was configured as error160315.png

@qgib
Copy link
Contributor Author

qgib commented Apr 30, 2017

Author Name: Giovanni Manghi (@gioman)


  • regression was configured as 0
  • easy_fix was configured as 0

@qgib
Copy link
Contributor Author

qgib commented Mar 9, 2019

Author Name: Giovanni Manghi (@gioman)


End of life notice: QGIS 2.18 LTR
*
Source:*
http://blog.qgis.org/2019/03/09/end-of-life-notice-qgis-2-18-ltr/


  • status_id was changed from In Progress to Closed
  • resolution was changed from to end of life

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! GRASS
Projects
None yet
Development

No branches or pull requests

1 participant