Author Topic: Slick-C Error inPython when typing "printf("  (Read 162 times)

JeppeOland

  • Community Member
  • Posts: 39
  • Hero Points: 2
Slick-C Error inPython when typing "printf("
« on: September 14, 2023, 01:25:28 am »
Obviously because I'm not a Python guy except in a pinch, so "printf" is muscle memory.
Anyways ... type it in SlickEdit, and it helpfully replaces it with just "print", but also pops up an error:
"Variable element or variable not initialized. file=codehelp.ex offset=27306"
Sometimes the first part is just a ?.

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 3910
  • Hero Points: 512
Re: Slick-C Error inPython when typing "printf("
« Reply #1 on: September 14, 2023, 12:43:36 pm »
I will look into this.  Could you send the the most recent part of <slickedit-config-dir>/logs/stack.log ?

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 3910
  • Hero Points: 512
Re: Slick-C Error inPython when typing "printf("
« Reply #2 on: September 14, 2023, 01:28:38 pm »
Never mind, that was easier to reproduce than I expected.

JeppeOland

  • Community Member
  • Posts: 39
  • Hero Points: 2
Re: Slick-C Error inPython when typing "printf("
« Reply #3 on: September 15, 2023, 07:30:54 am »
Similarly, typing "numpy.sign(" replaces with "sin()" and gives the same error.
(replacing in this case is wrong since there IS a sign function)

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 3910
  • Hero Points: 512
Re: Slick-C Error inPython when typing "printf("
« Reply #4 on: September 15, 2023, 02:16:56 pm »
You can turn off the auto-correct feature by going to Document > Python Options... > Completion Options > | | Auto-correct identifier before operator.  The same option applies both to "." operators and function argument help / open paren.

I might be able to tweak things to handle the "numpy" case, I assume that the reason that it tries to replace with "sin" is because it can not find numpy.sign.  You could try creating a language specific tag file for Python in order to have the numpy module tagged.

JeppeOland

  • Community Member
  • Posts: 39
  • Hero Points: 2
Re: Slick-C Error inPython when typing "printf("
« Reply #5 on: September 15, 2023, 02:40:57 pm »
Is "numpy" not being automatically tagged?

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 3910
  • Hero Points: 512
Re: Slick-C Error inPython when typing "printf("
« Reply #6 on: September 15, 2023, 02:51:22 pm »
Looks like our automatic Python tagging only gets the standard Python packages.  Numpy is an add-on.

It is a pretty commonly used package, I might look into adding information for it to our "python.tagdoc". 
It might be a good idea to add PyTorch too.  I will look into it.

JeppeOland

  • Community Member
  • Posts: 39
  • Hero Points: 2
Re: Slick-C Error inPython when typing "printf("
« Reply #7 on: September 15, 2023, 03:02:09 pm »
Yeah those are pretty common.
Stuff like matplotlib.pyplot is also pretty frequently used.

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 3910
  • Hero Points: 512
Re: Slick-C Error inPython when typing "printf("
« Reply #8 on: September 15, 2023, 09:54:52 pm »
The original problem will be fixed in the next beta.  The proportion of "easy to reproduce" / "easy to fix" for this one was out of this world.

JeppeOland

  • Community Member
  • Posts: 39
  • Hero Points: 2
Re: Slick-C Error inPython when typing "printf("
« Reply #9 on: September 15, 2023, 10:09:26 pm »
Best kind of bug there is (for the guy fixing it) ;D