Git Product home page Git Product logo

Comments (12)

bostick avatar bostick commented on May 24, 2024 1

Great to know that the update works!

I believe that it is understood that Wolfram Engine is a stripped down version of Mathematica, so missing usage messages may be expected, but I will verify.

Very interesting about `DateObject returning unevaluated.

Here is what I get on my system:

brenton@brenton2maclap build % /Applications/Wolfram\ Engine.app/Contents/MacOS/WolframKernel
Wolfram Language 12.3.1 Engine for Mac OS X x86 (64-bit)
Copyright 1988-2021 Wolfram Research, Inc.

In[1]:= DateObject[{"Tue 24 Aug 2021 15:00:00", {"DayName"," ","Day"," ","MonthName"," ","Year", " ","Hour",":","Minute",":","Second"}}]                                                                                                        

Out[1]= DateObject[{2021, 8, 24, 15, 0, 0.}, Instant, Gregorian, -5.]

In[2]:= DateObjectQ[%]                                                                                                                                                                                                                          

Out[2]= True                                                                                                                                                                                                                                  

I will investigate further and report back what I find.

from vscode-wolfram.

bostick avatar bostick commented on May 24, 2024

Thanks for the report!

I have published an update of the extension that addresses some of these problems.

Please restart VSCode and you should see version 1.3.2 of the extension.

Make sure you have version 1.3.2, try things again, and let me know how it goes.

I do not understand the warning:

LSPServer BuildDate cannot be parsed: DateObject[{Tue 24 Aug 2021 15:00:00, {DayName, , Day, , MonthName, , Year, , Hour, :, Minute, :, Second}}]

It is as if the code DateObject[{"Tue 24 Aug 2021 15:00:00", {"DayName", " ", "Day", " ", "MonthName", " ", "Year", " ", "Hour", ":", "Minute", ":", "Second"}}] is returning unevaluated on your system.

If you don't mind, could you try evaluating DateObject[{"Tue 24 Aug 2021 15:00:00", {"DayName", " ", "Day", " ", "MonthName", " ", "Year", " ", "Hour", ":", "Minute", ":", "Second"}}] and pasting the results here?

from vscode-wolfram.

ted1277 avatar ted1277 commented on May 24, 2024

Version 1.3.2 of the extension solves the problem. No error messages now.

About the warning message

  1. This warning message only shows when I use the WolframKernel of Wolfram Engine, resulting "No usage message" for all functions.
  2. The usage of functions would show when use the WolframKernel of Mathematica.
  3. The code you mentioned is indeed not evaluated when use the wolframscript.exe of Wolfram Engine (which will be evaluated when I put it in the notebook of Mathematica)

Here is the output in wolframscript.exe of Wolfram Engine

In[1]:=DateObject[{"Tue 24 Aug 2021 15:00:00", {"DayName"," ","Day"," ","MonthName"," ","Year", " ","Hour",":","Minute",":","Second"}}]
DateObject::str: String Tue 24 Aug 2021 15:00:00 cannot be interpreted as a date.
Out[1]= DateObject[{Tue 24 Aug 2021 15:00:00, {DayName,  , Day,  , MonthName,  , Year,  , Hour, :, Minute, :, Second}}]

from vscode-wolfram.

bostick avatar bostick commented on May 24, 2024

Here is what I see when I run wolframscript.exe:

Wolfram Language 12.3.1 Engine for Microsoft Windows (64-bit)
Copyright 1988-2021 Wolfram Research, Inc.

In[1]:= $Version                                                                                                        
Out[1]= 12.3.1 for Microsoft Windows (64-bit) (June 24, 2021)

In[2]:= DateObject[{"Tue 24 Aug 2021 15:00:00", {"DayName"," ","Day"," ","MonthName"," ","Year", " ","Hour",":","Minute",":","Second"}}]                                                                                                        
Out[2]= DateObject[{2021, 8, 24, 15, 0, 0.}, Instant, Gregorian, -4.]

In[3]:= DateObjectQ[%]                                                                                                  
Out[3]= True

It evaluates fine.

I'm not sure what the trouble you are seeing could be.

I'm going to close this issue, but if you see any further trouble with VSCode or LSPServer, then please open another issue.

from vscode-wolfram.

ted1277 avatar ted1277 commented on May 24, 2024

Thanks for your efforts! I guess this may be a problem with my Wolfram Engine, I'm gonna leave it as it only results a warning message when I use the extension in VS code (Actually, I don't really need the usages of functions shown in VS code; I think the syntax highlighting and checking are useful).

Below is what I found in my wolframscript.exe

Wolfram Language 12.3.1 Engine for Microsoft Windows (64-bit)
Copyright 1988-2021 Wolfram Research, Inc.

In[1]:= $Version

Out[1]= 12.3.1 for Microsoft Windows (64-bit) (June 24, 2021)

In[2]:= DateObject[{"Tue 24 Aug 2021 15:00:00", {"DayName"," ","Day"," ","MonthName"," ","Year", " ","Hour",":","Minute",":","Second"}}]

DateObject::str: String Tue 24 Aug 2021 15:00:00 cannot be interpreted as a date.

Out[2]= DateObject[{Tue 24 Aug 2021 15:00:00, {DayName,  , Day,  , MonthName,  , Year,  , Hour, :, Minute, :, Second}}]

In[3]:= DateObjectQ[%]

Out[3]= False

In[4]:= DateObject[{"24 2021 15:00:00", {"Day"," ","Year", " ","Hour",":","Minute",":","Second"}}]

Out[4]= DateObject[{2021, 1, 24, 15, 0, 0.}, Instant, Gregorian, 8.]

In[5]:= DateObjectQ[%]

Out[5]= True

from vscode-wolfram.

bostick avatar bostick commented on May 24, 2024

OK, I am now interested in solving this, so I have a few more questions:

What does this return:

FromDateString["Tue 24 Aug 2021 15:00:00", <|
  "Elements" -> {"DayName", " ", "Day", " ", "MonthName", " ", "Year",
     " ", "Hour", ":", "Minute", ":", "Second"}|>]

and this:

FromDateString["Tue 24 Aug 2021 15:00:00", <|"Language" -> "en",
    "Elements" -> {"DayName", " ", "Day", " ", "MonthName", " ", 
    "Year",
         " ", "Hour", ":", "Minute", ":", "Second"}|>]

and what is the value of

System`DateStringDump`$DateStringLocale

For example, here is what I get after running these 3 inputs:

In[102]:= FromDateString["Tue 24 Aug 2021 15:00:00", <|
  "Elements" -> {"DayName", " ", "Day", " ", "MonthName", " ", "Year",
     " ", "Hour", ":", "Minute", ":", "Second"}|>]

Out[102]= DateObject[{2021, 8, 24, 15, 0, 
  0}, "Instant", "Gregorian", "America/Chicago"]

In[103]:= FromDateString["Tue 24 Aug 2021 15:00:00", <|
  "Language" -> "en", 
  "Elements" -> {"DayName", " ", "Day", " ", "MonthName", " ", "Year",
     " ", "Hour", ":", "Minute", ":", "Second"}|>]

Out[103]= DateObject[{2021, 8, 24, 15, 0, 
  0}, "Instant", "Gregorian", "America/Chicago"]

In[104]:= System`DateStringDump`$DateStringLocale

Out[104]= "en"

from vscode-wolfram.

ted1277 avatar ted1277 commented on May 24, 2024

I also thought this may be related to the language setting or something like time zone setting.
But both the first two code pieces you provided return the right DateObject.

Here are the results from my system

Wolfram Language 12.3.1 Engine for Microsoft Windows (64-bit)
Copyright 1988-2021 Wolfram Research, Inc.

In[1]:= FromDateString["Tue 24 Aug 2021 15:00:00", <|
          "Elements" -> {"DayName", " ", "Day", " ", "MonthName", " ", "Year",
             " ", "Hour", ":", "Minute", ":", "Second"}|>]

Out[1]= DateObject[{2021, 8, 24, 15, 0, 0.}, Instant, Gregorian, Asia/Shanghai]

In[2]:= FromDateString["Tue 24 Aug 2021 15:00:00", <|"Language" -> "en",
            "Elements" -> {"DayName", " ", "Day", " ", "MonthName", " ", 
            "Year",
                 " ", "Hour", ":", "Minute", ":", "Second"}|>]

Out[2]= DateObject[{2021, 8, 24, 15, 0, 0.}, Instant, Gregorian, Asia/Shanghai]

In[3]:= System`DateStringDump`$DateStringLocale

Out[3]= en

from vscode-wolfram.

hidrotule2001 avatar hidrotule2001 commented on May 24, 2024

Jumping in here with a few follow-up tests:

DateObject[{"Tue 24 Aug 2021 15:00:00", {"DayName", " ", "Day", " ", "MonthName", " ", "Year", " ", "Hour", ":", "Minute", ":", "Second"}}]; 
LanguageLocale`$SystemLocale

System`DateStringDump`parseDateStringFunction["Tue 24 Aug 2021 15:00:00", "EEEE' 'dd' 'MMMM' 'yyyy' 'HH':'mm':'ss", LanguageLocale`$SystemLocale, -5.`]

System`DateStringDump`parseDateStringFunction["Tue 24 Aug 2021 15:00:00", "EEEE' 'dd' 'MMMM' 'yyyy' 'HH':'mm':'ss", "en_US", -5.`]

from vscode-wolfram.

ted1277 avatar ted1277 commented on May 24, 2024

Hi, @hidrotule2001, here are the results

Wolfram Language 12.3.1 Engine for Microsoft Windows (64-bit)
Copyright 1988-2021 Wolfram Research, Inc.

In[1]:= DateObject[{"Tue 24 Aug 2021 15:00:00", {"DayName", " ", "Day", " ", "MonthName", " ", "Year", " ", "Hour", ":", "Minute", ":", "Second"}}]; 

DateObject::str: String Tue 24 Aug 2021 15:00:00 cannot be interpreted as a date.

In[2]:= LanguageLocale`$SystemLocale

Out[2]= zh_CN

In[3]:= System`DateStringDump`parseDateStringFunction["Tue 24 Aug 2021 15:00:00", "EEEE' 'dd' 'MMMM' 'yyyy' 'HH':'mm':'ss", LanguageLocale`$SystemLocale, -5.`]

Out[3]= LibraryFunctionError[LIBRARY_FUNCTION_ERROR, 6]

In[4]:= System`DateStringDump`parseDateStringFunction["Tue 24 Aug 2021 15:00:00", "EEEE' 'dd' 'MMMM' 'yyyy' 'HH':'mm':'ss", "en_US", -5.`]

Out[4]= LibraryFunctionError[LIBRARY_FUNCTION_ERROR, 6]

from vscode-wolfram.

hidrotule2001 avatar hidrotule2001 commented on May 24, 2024

@ted1277 ah that would explain it; it looks like the locale settings aren't aligned between the date parsing library and the kernel's detection of the system locale (these two components might use slightly different methods of detecting the locale). I would suggest checking the environment variable on the system in a couple of places and see if it's consistent:

in a command prompt:
systeminfo | findstr /B /C:"System Locale"

in msinfo32 (just type that name into the start menu)
under System summary there should be a 'Locale' field about half way down

in powershell (just type that name into the start menu)
Get-WinSystemLocale

my guess is that at least one of these will have zh_CN while the others will have en and setting them consistently should fix the problem (alternatively using the FromDateString input @bostick suggested would also work around it)

from vscode-wolfram.

ted1277 avatar ted1277 commented on May 24, 2024

I checked and found that all three places are zh_CN.

Another thing worth to mention, the Wolfram Engine I installed is from WolframEngine_12.3.1_WIN_CN.zip.
I download this zip file from the official website. Note that there is a CN in the name, I guess the version of my Wolfram Engine may have some difference with that of @bostick

from vscode-wolfram.

hidrotule2001 avatar hidrotule2001 commented on May 24, 2024

@ted1277 ok, then if the system locale is set to zh_CN it's likely the default locale parsing is going to try and stay with that for parsing month/day names. You could try temporarily setting the locale environment variables to "en" when running wolframscript for your application, or could alternatively use the FromDateString input from before with "Language" -> "en" to ensure the locale is correctly set for parsing the input)

from vscode-wolfram.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.