gcloud crashed (UnicodeEncodeError): 'ascii' codec can't encode character u'\xe7' in position 13: ordinal not in range(128) - gcloud

Welcome to the Google Cloud SDK! Run "gcloud -h" to get the list of
available commands.
C:\Program Files (x86)\Google\Cloud SDK>gcloud init Welcome! This
command will take you through the configuration of gcloud.
Your current configuration has been set to: [default]
You can skip diagnostics next time by using the following flag:
gcloud init --skip-diagnostics
Network diagnostic detects and fixes local network connection issues.
Checking network connection...done. Reachability Check passed. Network
diagnostic (1/1 checks) passed.
ERROR: gcloud crashed (UnicodeEncodeError): 'ascii' codec can't encode
character u'\xe7' in position 13: ordinal not in range(128)
If you would like to report this issue, please run the following
command: gcloud feedback
To check gcloud for common problems, please run the following command:
gcloud info --run-diagnostics
I don't know what to do... I just want to use the sdk but I can't init it...

Have a look at the file which gave error , edit the .py file to add following lines
import sys
reload(sys)
sys.setdefaultencoding('utf8')

Try edit the code in google-cloud-sdk/lib/third_party/socks/__init__.py(google-cloud-sdk is the archive you downloaded to install google cloud sdk) in line 262:
req = req + struct.pack(">H", destport)
to
if isinstance(req, unicode):
req = req.encode('UTF-8')
req = req + struct.pack(">H", destport)
reference: https://c11e.wodemo.com/gcloud-crashed-unicodedecodeerror

For me the fix was removing an accent ('é') from a folder in the path of my project. Hope it can help someone since I didn't find this solution after googling it for hours.

I kept getting this similar error every time I ran a gcloud command after a crash:
ERROR: gcloud crashed (UnicodeDecodeError): 'utf8' codec can't decode byte 0xa4 in position 1: invalid start byte
The solution was to delete this file:
~/.config/gcloud/gce
Don't ask me why that works or what that files does, I don't know (if you do, please let me know), but it gets recreated on the next command run and it fixed my issue.

In my case, it was a special character in the folders of the current directory. After changing the current directory, it worked!

As you’ve noticed that the error is due to a non-ASCII character in the username. As a workaround, you can set the CLOUDSDK_CONFIG environment variable to a path that contains only ASCII characters.

Related

Relative Path (pathlib) name working on MAC OS but on Windows gives me a error

Currently I am working a project that has have been using the pathlib library so I can work on my Windows desktop when I need too and on my MacBook Pro. Essentially be able to work between both operating systems. I have not have any issues at all until right now. Here is the set up:
I have a pipeline set up to automatically save a .joblib and a whole lot of .png files that will go to a directory called
output_dir = Path('../Trained_Models/Differential_gene_analysis/A Kidney Cancer Transcriptome Molecular Signature Identifies Tumors with Tumor Thrombus/Models train on TCGA data and test on Rodriguez data/Oct-XX-20XX')
For example, if I want to save a .joblib file under the name RandomForest_TumorThrombus_104.joblib,I would use the command
joblib.dump(model ,output_dir / 'RandomForest_TumorThrombus_104.joblib')
On my MacBook Pro, I have no issues when this is ran, but on Windows it gives me the following error
FileNotFoundError: [Errno 2] No such file or directory: '..\\Trained_Models\\Differential_gene_analysis\\A Kidney Cancer Transcriptome Molecular Signature Identifies Tumors with Tumor Thrombus\\Models train on TCGA data and test on Rodriguez data\\Oct-17-2022\\RandomForest_TumorThrombus_104.joblib'
I have tried to use the .resolve() method to get the absolute path but still gives me the same error. I have tried to experiment to try to see what is goin on such as using os.path.exists(). When using the os.path.exists() method I get True for the follwoing command:
os.path.exists(output_dir)
So it does indeed recognize that the directory exists. The next thing I tried was to rename the file to something like dddddd.joblib and that worked. But I find that only a few names for the file would allow me to save the files. During debug I found that the most recent Traceback occurs here:
with open(filename, 'wb') as f:```
I was wondering if anyone here had any idea what was going on here and how I can fix this issue? Please and Thank you.
The solution was to enable long paths on Windows.

installation error in shopware-pwa initialization

I am trying to install shopware-pwa. I am following the steps in https://github.com/vuestorefront/shopware-pwa
But at the first step while initializing the project npx #shopware-pwa/cli init
While installing I used default option:
* Shopware instance address: · https://shopware6-demo.vuestorefront.io
* Shopware instance access token: · SWSCVJJET0RQAXFNBMTDZTV1OQ
* Which version you'd like to use: latest stable (recommended)
Error: Command failed: npx --ignore-existing create-nuxt-app#3.2.0 --answers "{\"name\":\"shopware-pwa-project\",\"description\":\"shopware-pwa-project description\",\"author\":\"Vue Storefront\",\"pm\":\"yarn\",\"ui\":\"none\",\"language\":\"js\",\"server\":\"none\",\"features\":[\"axios\",\"pwa\"],\"linter\":[\"prettier\",\"lintStaged\"],\"test\":\"jest\",\"mode\":\"universal\",\"target\":\"server\",\"devTools\":[],\"gitUsername\":\"\",\"ci\":\"none\"}"
npx: the --ignore-existing argument has been removed.
See `npm help exec` for more information
Trace: Error: Answers JSON could not be parsed (Unexpected token n in JSON at position 1)
at SAO.runGenerator (/home/user/.npm/_npx/059d932392171cf4/node_modules/sao/lib/index.js:126:15)
at SAO.run (/home/user/.npm/_npx/059d932392171cf4/node_modules/sao/lib/index.js:101:16)
at /home/user/.npm/_npx/059d932392171cf4/node_modules/create-nuxt-app/lib/cli.js:51:17
Does anybody come up with the issue?
I found issue #612 in the create-nuxt-app GitHub repository.
It seems that after the --answers argument you'd have to start with a sinqle quote (') and then paste your configuration as a JSON. The JSON must not contain any linefeeds/carriage returns and there must not be any whitespaces ( ) between the properties.
So in your case your bash command should look like this:
npx --ignore-existing create-nuxt-app#3.2.0 --answers '{"name":"shopware-pwa-project","description":"shopware-pwa-project description","author":"Vue Storefront","pm":"yarn","ui":"none","language":"js","server":"none","features":["axios","pwa"],"linter":["prettier","lintStaged"],"test":"jest","mode":"universal","target":"server","devTools":[],"gitUsername":"","ci":"none"}'
I've tried it on my machine just now and it worked. I only got a warning becausethe --ignore-existing argument has been removed.
hope that this solves your problem!
greetings

openfoam ./makeParaview

i am currently building openfoam 1912 from source and have some trouble building paraview. I just build Qt and Cmake but as soon as i type ./makeParaview qt-5.9.9 5.6.3i get the following error:
./makeParaView: 64: local: -DWM_DP: bad variable name
./makeParaView: 64: ./makeParaView: -DOPENFOAM: bad variable name
A similar error occurs when i try to make VTK / Adios2. Any idea where i took the wrong turn?
Greetings
Gabbagandalf
The proper solution is related to shell quoting issues
- flag="$(stripCompilerFlags $flag)"
+ flag="$(stripCompilerFlags "$flag")"
but in the meantime you can simply change the shebang to #!/bin/bash - it is more forgiving.
As discussed and resolved in these GitLab ticket-1 and ticket-2:
The issue seems to be Ubuntu related.
Solution:
Prior to execute ./makeParaview, switch to bash:
Change the first line of makeParaView script to #!/bin/bash
sudo dpkg-reconfigure dash
./makeParaView

capistrano upload! thinks ~ referenced local directory is on remote server

So every example I've looked up indicates this is how one is supposed to do it but I think I may have found a bug unless there's another way to do this.
I'm using upload! to upload assets to a remote list of servers. The task looks like this:
desc "Upload grunt compiled css/js."
task :upload_assets do
on roles(:all) do
%w{/htdocs/css /htdocs/js}.each do |asset|
upload! "#{fetch(:local_path) + asset}", "#{release_path.to_s + '/' + asset}", recursive: true
end
end
end
If local_path is defined as an absolute path such as:
set :local_path:, '/home/dcmbrown/projects/ABC'
This works fine. However if I do the following:
set :local_path:, '~/projects/ABC'
I end up getting the error:
The deploy has failed with an error: Exception while executing on ec2-54-23-88-125.us-west-2.compute.amazon.com: No such file or directory - ~/projects/ABC/htdocs/css
It's not a ' vs " issue as I've tried both (and I didn't think capistrano paid attention to that anyway).
Is this a bug? Is there a work around? Am I just doing it wrong?
I ended up discovering the best way to do this is to actually use path expansion! (headsmack)
irb> File.expand_path('~dcmbrown/projects/ABC')
=> "/home/dcmbrown/projects/ABC"
Of course what I'd like is to do automatic path expansion but you can't have everything. I think I was mostly dumbstruck that it didn't automatically; so much so I spent a couple of hours trying to figure out why it didn't work and ended up wasting time asking here. :(
I don't think the error is coming from the remote server, it just looks like it since it's running that upload command in the context of a deploy.
I just created a single cap task to just do an upload using the "~" character and it also fails with
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as deploy#XXX: No such file or directory # rb_file_s_stat - ~/Projects/testapp/public/404.html
It appears to be a Ruby issue not Capistrano as this also fails in a Ruby console
~/Projects/testapp $ irb
2.2.2 :003 > File.stat('~/Projects/testapp/public/404.html')
Errno::ENOENT: No such file or directory # rb_file_s_stat - ~/Projects/testapp/public/404.html
from (irb):3:in `stat'
from (irb):3
from /Users/supairish/.rvm/rubies/ruby-2.2.2/bin/irb:11:in `<main>'

Algebra filter error in moodle

I installed moodle 1.9.12 and now I want to use Algebra notation in content. I enable "TeX Notation" and "Algebra Notation" in administrator panel and also install mimetext and dvips and Imagemagic on the server. fortunately Tex Notation works fine but I got the following error for Algebra:
sh: /var/www/html/moodle/filter/tex/mimetex.linux: not found
The shell command
"/var/www/html/moodle/filter/tex/mimetex.linux" -e "/var/www/moodledata/filter/algebra/de06d6c44d98ba4e42dffca988bf530b.gif" -- '\Large \frac{\sin\left(z\right)}{x^{2}+y^{2}}'
returned status = 127
File size of mimetex executable /var/www/html/moodle/filter/tex/mimetex.linux is 830675
The file permissions are: 100775
The md5 checksum of the file is 56bcc40de905ce92ebd7b083c76e019e
Image not found!
Note: /var/www/html/moodle/filter/tex/mimetex.linux exists on the server and is executable!!!
What is the problem?? Any idea?????
From what you have described, calling the general tex filter debug page works and does not show up the same error.
/filter/tex/texdebug.php works, but /filter/algebra/algebradebug.php does not.
If this is the case, perhaps you could check for an open_basedir, or safe_mode_exec_dir being set to include the current working directory, or otherwise restricting the execution of /var/www/html/moodle/filter/tex/mimetex.linux, while the current working directory is /var/www/html/moodle/filter/algebra.
You could look at this by visiting /admin/phpinfo.php at your site, and look carefully at the effective values of open_basedir, safe_mode and safe_mode_exec_dir.
You could also check the apache error log or add the following lines to the top of the algebra debug php file, and you might see some extra error messages:
$CFG->debug = 6143 ;
$CFG->debugdisplay= 1 ;
Hope that helps