Questions tagged [write-error]
20 questions
16
votes
4 answers
Writing to error stream in Powershell using Write-Error
Why isn't Powershell's Write-Error cmdlet working for me? My output doesn't look like the examples in the documentation:
PS C:\> Write-Error "This is an error"
Write-Error "This is an error" : This is an error
+ CategoryInfo :…

sourcenouveau
- 29,356
- 35
- 146
- 243
3
votes
2 answers
Write-Error doesn't result useful information when used inside class methods | Powershell
I used a method with and without a class and the Write-Error seems to produce different outputs. In case of class, it doesn't specify the function and the line number is always 1,1
function oper1() {
Try {
[string] $cmd =…

Pankaj Kumar
- 113
- 1
- 5
2
votes
1 answer
How do I actually generate an error using $PSCmdlet.WriteError in PowerShell?
I've been reading up on generating error messages in PowerShell and stumbled across this example...
$Exception = [Exception]::new("error message")
$ErrorRecord = [System.Management.Automation.ErrorRecord]::new(
$Exception,
"errorID",
…

Dennis
- 871
- 9
- 29
2
votes
2 answers
How can I resolve write errors that I have in my data?
I have a dataframe (more than 1 million rows) that has an open text columns for customer can write whatever they want.
Misspelled words appear frequently and I'm trying to group comments that are grammatically the same.
For…

Maite89
- 273
- 2
- 8
2
votes
1 answer
Document validation in MongoDB issue
So I'm very new to MongoDB and of course the feedback on when documents fail validation is somewhat... uninformative. So I'm hopeful anyone might see the error(s) I've made.
The schema is relatively simple and…

user3684314
- 707
- 11
- 31
2
votes
1 answer
Powershell Write-Error does not populate -ErrorVariable
I am running Powershell 4, and am trying to get an error variable to populate in a function by using the -ErrorVariable parameter in the call, and write-error within the function itself. However the variable never gets populated.
Here is my…

PRS
- 741
- 1
- 7
- 27
2
votes
1 answer
Why is Write-Error displaying all code above it?
I was recently reading on reasons not to use Write-Host in PowerShell, so I've started using Write-Verbose, Write-Warning and Write-Output...but I'm having some issues with the output that I'm getting from Write-Error.
Here is a simple example of…

John-Rock Bilodeau
- 377
- 5
- 15
2
votes
0 answers
CImg gives error Access violation writing location for reading PNG file
I try to run this very simple code and I get a strange error at the CImg library at line png_read_info(png_ptr,info_ptr); the error is: Unhandled exception at 0x779f8dc9 in test.exe: 0xC0000005: Access violation writing location 0x00000014. the…

Momo
- 31
- 3
1
vote
1 answer
Write-error gives weird characters when redirecting to a file in powershell core
Hello I have the following test code in powershell 7.1 and 7.2 preview.
Write-Output "Lalala" 1> C:\Temp\test.txt
Write-Error "This is a test" 2>&1 >> C:\Temp\test.txt
Write-Warning "Test Testt" 3>&1 >> C:\Temp\test.txt
Write-Information…

LangsGalgEnRad
- 65
- 6
1
vote
1 answer
Strange behaviour of Write-Error (PowerShell): no output from within methods with a return value
The output of Write-Error is ommited in methods that have a return value (i.e. are not void):
Class MyClass {
[void]MethodWithoutReturnValue([string]$Msg) {
Write-Error "MyClass.MethodWithoutReturnValue(): $Msg"
}
…

Jack Charon
- 38
- 4
1
vote
1 answer
Writing ntag213 (Mifare Ultralight C) with mxgxw/MFRC522-python Library and MFRC522 Reader on Raspi 2
For a school project we are trying to write on ntag213 (Mifare Ultralight C 180Bytes) and we are not capable of writing on it. Beside of that the library is working fine with reading the Ultralight C/ntag213.
The same setting, library and hardware…

Tschabadu
- 161
- 1
- 8
1
vote
1 answer
usb4java Error while sending message: USB error 1: Control transfer failed: Input/Output Error
I try to send a message with the usb4java api to a ir read and write element with this code:
public static void sendData(DeviceHandle handle, int timeout) {
ByteBuffer buffer = ByteBuffer.allocateDirect(12);
buffer.put(new byte[]{1, 2,…

Harry Lumperd
- 33
- 9
0
votes
1 answer
Why is insertMany function throwing error?
I am trying to add in details onto my mongodb cluster. Here is how I am trying to do:
async function insertDummyCategoryData(){
try{
await Category.insertMany([
{
"name": "Thai",
"image": "1.jpg"
},
…

Swati
- 1
- 1
0
votes
1 answer
What could be causing this memory access error (C++)? Might be undefined behavior?
I have a relatively large class that I'm working with and it's all worked fine so far (note: I didn't actually write the class, I'm just adding some functionality). However, after declaring one more string in the header file, everything now crashes…

Casey Patton
- 4,021
- 9
- 41
- 54
0
votes
2 answers
Spark: LeaseExpiredException while writing large dataframe to parquet files
I have a large dataframe which I am writing to parquet files in HDFS. Getting the below exception from logs :
2018-10-15 18:31:32 ERROR Executor:91 - Exception in task 41.0 in stage 0.0 (TID 1321)
org.apache.spark.SparkException: Task failed while…

Anirban
- 23
- 4