0

When I am trying to add files from the command line I get the error saying files not in client view what does it mean ?

createdCLNumber = p4.save_change(changeList)[0].split()[1]
>>> createdCLNumber
'1157539'
>>> p4.run_add("-c", createdCLNumber, "/Users/ciasto/ciasto_piekarz/sandbox/main/upgrade_tools/upgrade_gitlab")
Traceback (most recent call last):

P4.P4Exception: [P4#run] Warnings during command execution( "p4 add -c 1157539 /Users/ciasto/ciasto_piekarz/sandbox/main/upgrade_tools/upgrade_gitlab" )

        [Warning]: '/Users/ciasto/ciasto_piekarz/sandbox/main/upgrade_tools/upgrade_gitlab - file(s) not in client view.'
Ciasto piekarz
  • 7,853
  • 18
  • 101
  • 197

1 Answers1

0

The error means that the file you are trying to add is not in your client view.

According to the error message, the local file is:

/Users/ciasto/ciasto_piekarz/sandbox/main/upgrade_tools/upgrade_gitlab

Is this path under your client's Root, and does the View map it to a depot path? If not, there's no defined depot path for it to be added to.


Unsolicited advice time: I would highly recommend gaining some basic familiarity with Perforce from the command line before trying to automate Perforce workflows with P4Python! It's much easier to make corrections for simple beginner mistakes like this and gain an understanding of the core concepts (e.g. how to define client workspaces and use them to interact with depot files) if you're entering commands at an interactive prompt than if you have to modify a script and start over from scratch for each debugging session. Everything you learn at the command line has a 1:1 mapping to the Python API, so the knowledge will transfer extremely well. The API is designed for people who already have familiarity with Perforce commands and data models, so people who dive into it without knowing Perforce beforehand always end up feeling very lost. I've seen it a hundred times.

(Almost every time I give this advice people ignore it because they "don't have time" to learn how to use the CLI before diving into writing their script, but I can guarantee you're going to end up spending about a month learning how to use Perforce via P4Python when you could have mastered it in a single afternoon of messing around in the terminal.)

Samwise
  • 68,105
  • 3
  • 30
  • 44
  • there is a very specific use case and in the future the perforce may not even be used at my workplace. one thing I have noticed, the perforce python api try to thing magically, when every files to be added to to a sand path to be submitted is related to a changelist number the public python functions must request changelist number, and changelist number creation shoudl be a must. – Ciasto piekarz Jun 02 '20 at 15:34
  • like I said, nobody ever takes the advice. :) You'll have to acquire the knowledge of how this stuff works no matter what, but it's up to you whether to do it the easy way or the hard way. – Samwise Jun 02 '20 at 15:35
  • BTW I am going through the API though.. I have been using perforce view only for 3 months now. I appreciate your effort and admire the direction you are giving me. thank you – Ciasto piekarz Jun 02 '20 at 15:37